{# Self-contained ask fragments for a booth's VERBATIM index.html. The page is served untouched and carries its own CSS, so nothing here may inherit from base.html. Since U3 these fragments do not reach the page by string substitution: they are rendered here, handed over `/b//embed.json`, and MOUNTED INTO THE DOM by `/_booth/embed.js`. The scoped `.bk-ask-*` styles live in that file alongside the code that needs them, which is why this template no longer emits a `styles()` block. These macros stay the ONE renderer of an ask fragment. embed.js places what comes back and never builds one. 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. #} {# 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_enabled %} {% 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

this question 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 %}