{# Shared answer composer: paste/drop/pick screenshots, preview them, and (when editable) the answer textarea itself — all inside one container so a paste anywhere in here (focus in the textarea included) is caught by a single listener in static/app.js (App.initAttachmentComposer). Expected context variables, set by the including template before `{% include %}`: composer_decision_id int, required composer_attachments list of attachment rows (id, filename, ...), required composer_editable bool — show the add-control + answer form composer_show_headings bool — show the visible "Your answer" label (detail page) composer_thumb_compact bool — use the smaller thumbnail size (index cards) composer_id_suffix string — appended to the textarea id, for uniqueness when several composers render on one page composer_placeholder string — textarea placeholder (optional) composer_submit_label string — submit button text (only used if editable) composer_decision the decision dict (parsed options) — enables the one-click quick answers; the textarea then doubles as their note composer_next path to return to after answering (optional) #} {% from "_macros.html" import icon %} {% macro thumbs(attachments, editable, compact) -%} {%- for a in attachments -%}
{%- if editable %} {%- endif %}
{%- endfor -%} {%- endmacro %}
{% if composer_editable %}
{% if composer_next %}{% endif %} {% set d = composer_decision %} {% set is_action_composer = d and d.kind == "action" %} {% if d %} {# formnovalidate: a quick answer is complete on its own; the box is only its note. #} {% if is_action_composer and d.action_spec %} {% set spec = d.action_spec %}
{% if spec.where %} {{ icon("external") }}Open where to do it {% endif %} {% if spec.steps %}
    {% for step in spec.steps %}
  1. {{ step }}
  2. {% endfor %}
{% endif %} {% set spec_values = spec.get("values") %} {% if spec_values %}
{% for v in spec_values %}
{{ v.label }}
{{ v.value }}
{% endfor %}
{% endif %} {% if spec.inputs %}
{% for field in spec.inputs %} {% endfor %}
{% endif %} {% if spec.done_when %}

Done when: {{ spec.done_when }}

{% endif %} {% if spec.verify %} {% set c = spec.verify %}

{{ icon("check-circle") }} Done checks it first: {% if c.type == "dns" %}{{ c.record_type or "A" }} record for {{ c.name }}{% if c.contains %} containing {{ c.contains }}{% endif %} {% elif c.type == "http" %}{{ c.url }} returns {{ c.status or 200 }}{% if c.contains %} with “{{ c.contains }}”{% endif %} {% elif c.type == "file" %}{{ c.path }} exists in the repo {% elif c.type == "env" %}{{ c.name }} is set in the repo's .env {% elif c.type == "pr_merged" %}the PR is merged{% endif %}.

{% endif %}
{% endif %}
{% if is_action_composer %}
{% if not composer_skip_primary %}{% endif %}
{% else %} {% if d.options %}
{% for o in d.options %} {% endfor %}
{% endif %}
{% if d.recommendation and not composer_skip_primary %} {% endif %}
{% endif %}
{% endif %}
{{ thumbs(composer_attachments, true, composer_thumb_compact) }}
= 6 %} hidden{% endif %}> or paste / drop · up to 6, 10MB each
{% if composer_note_submit %} {% else %} {% endif %}
{% else %}
{{ thumbs(composer_attachments, false, composer_thumb_compact) }}
{% endif %}