{# The vote and delete views redirect to the post, which ends on its topic page - htmx picks this widget out of that, or nothing once the poll is deleted. Every swap attribute is set on the vote form and the delete button, because the post sits inside the topic page's element that sets the swap targets of its moderation actions. #}
{{ poll.question }}
{% if can_vote and not editing and not summary.user_option_ids %}
{{ form.hidden_tag() }} {% for option in poll.options %}
{% endfor %}
{% else %}
    {% for option in poll.options %} {% set count = summary.counts[option.id] %} {% set percentage = (100 * count / summary.total) if summary.total else 0 %}
  • {{ option.text }} {{ "%.0f"|format(percentage) }}% ({{ count }})
  • {% endfor %}
{% if editing %} {{ _("This poll cannot be changed here.") }} {% else %} {{ _("%(count)s total votes", count=summary.total) }} {% if not can_vote %} · {{ _("Log in to vote.") }}{% endif %} {% endif %} {% endif %} {% if can_delete %} {# A button rather than a form: on the post and topic edit pages this widget sits inside the edit form, and the browser drops a nested form. htmx sends the CSRF token as a header, and hx-params="none" keeps the edit form's fields out of the request. #}
{% endif %}