{# Self-contained ask fragments injected into a booth's VERBATIM index.html. The page is served untouched and carries its own CSS, so nothing here may inherit from base.html: every fragment ships its own scoped `.bk-ask-*` styles (emitted once, by `styles()`), and the palette adapts via prefers-color-scheme rather than borrowing the host page's. Per-question fragments are wired to ONE form with the HTML5 `form=` attribute, so a four-voice report can put each radio group under its own audio block and still submit all four picks in a single POST — which is what the multi-question ask requires. The
element itself is empty and lives with the submit block. No JavaScript. #} {% macro styles() %} {% endmacro %} {# One question's radio group, bound to the shared form by id. #} {% macro question(a, q, form_id, name_url, standalone=False) %} {% set field = 'choice.' ~ q.key if a.multi else 'choice' %} {% set qa = (a.answer.answers.get(q.key) if a.multi else a.answer) if a.answer else None %} {% set picked = qa and qa.choice is not none %} {% set skipped = a.answer and not picked %}
{% if picked %}✓ answered{% elif skipped %}— skipped{% else %}? your pick{% endif %}

{{ q.prompt }}

{% if picked %}

recorded: {{ qa.label }}{% if qa.notes %} — {{ qa.notes }}{% endif %}

{% elif skipped %}

left blank — pick one any time, or leave it{% if qa and qa.notes %}; note: {{ qa.notes }}{% endif %}

{% endif %}
{% for o in q.options %} {% endfor %}
{% if q.notes %} {% endif %}
{% endmacro %} {# The form element + hidden fields + overall notes + submit. Empty on purpose: the question groups above bind to it by id from wherever they sit. #} {% macro submit(a, form_id, name_url) %}
{% if a.answer and a.answer.complete %}✓ answered {{ a.answer.answered_at }} {%- elif a.answer %}◐ {{ a.questions|length - (a.answer.unanswered|length) }} of {{ a.questions|length }} answered · {{ a.answer.answered_at }} {%- else %}? submit your picks{% endif %} {% if not a.answer %}

Answer what you can — blanks are fine, and you can come back.

{% endif %} {% if a.notes %} {% endif %}
{% endmacro %} {# The whole ask as one self-contained block: title, every question, submit. #} {% macro whole(a, form_id, name_url) %} {% if a.error %}
⚠ broken ask

{{ a.stem }}.ask.json could not be read: {{ a.error }}

{% else %} {% if a.title %}

{{ a.title }}

{% endif %} {% for q in a.questions %}{{ question(a, q, form_id, name_url) }}{% endfor %} {{ submit(a, form_id, name_url) }} {% endif %} {% endmacro %}