24 lines
763 B
HTML
24 lines
763 B
HTML
{% macro choices(poll) %}
|
||
<fieldset>
|
||
{% for choice in poll.choices %}
|
||
<input type="radio" id="{{ poll.id }}-{{ choice.id }}" name="pollanwsers" value="{{ choice.id }}" />
|
||
<label for="{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label><br/>
|
||
{% endfor %}
|
||
</fieldset>
|
||
{% endmacro %}
|
||
|
||
{% macro results(poll) %}
|
||
<table>
|
||
{% for choice, votes in poll.results.most_common() %}
|
||
<tr>
|
||
<td><label for="{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label></td>
|
||
<td>
|
||
<progress id="{{ poll.id }}-{{ choice.id }}" value="{{ votes }}" max="{{ n_answers }}">
|
||
{{ votes / n_answers if n_answers else 0 }} % ({{ votes }})
|
||
</progress>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</table>
|
||
{% endmacro %}
|