summaryrefslogtreecommitdiff
path: root/templates/vote.html
blob: 0174a1896200e2ca5ab36b3b5a11594b36b7a30a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{% load i18n %}
{% extends "base.html" %}

{% block content %}
 <h2>{{poll_type_name}} - {{poll_name}}</h2>
{% if error %}<p class='error'>{{ error }}</p>{% endif %}
 <p>{{poll_desc}}</p>
 <form method='post' action='{{base_url}}'>
 <div id='poll_table'>
 <table id='poll'>
 <tr>
  <td class='simple'></td>
  <td class='simple'></td>
  {% for choice in choices %}<th>{{choice.name}}</th>
 {% endfor %}</tr>
 {% for voter in voters %}<tr>{% ifequal current_voter_id voter.id %}
  <input type='hidden' name='voter' value='{{voter.id}}'/>
  <td class='simple'></td>
  <td><input type='text' name='author_name' value='{{voter.name}}'/></td>
  {% for vote in voter.votes %}<td><input type='checkbox' name='{%if vote.id%}vote_{{vote.id}}{%else%}choice_{{vote}}{%endif%}'{%ifequal vote.value 1%} checked='checked'{%endifequal%}/></td>{%endfor%}
  {%else%}<td class='simple'><a href='?voter={{voter.id}}'>{% trans "Edit" %}</a></td>
  <td>{{voter.name}}</td>
  {% for vote in voter.votes %}<td class='{%ifequal vote.value 1%}OK{%else%}KO{%endifequal%}'>{% ifequal vote.value 1%}Yes{%else%}No{%endifequal%}</td>
  {%endfor%}
  {%endifequal%}
 </tr>{%endfor%}
 {%if not current_voter_id%}
 <tr>
  <td class='simple'></td>
  <td><input type='text' name='author_name'/></td>
  {%for choice in choices%}<td><input type='checkbox' name='choice_{{choice.id}}'/></td>{%endfor%}
 </tr>
 {%endif%}
 <tr id='sum'>
  <td class='simple'></td><th>{% trans "Sum" %}</th>
  {% for sum in choices_sum %}<td>{{sum}}</td>
  {% endfor %}
 </tr>
 </table>
 </div>
 <input type='submit' value='{%if current_voter_id%}{% trans "Edit" %}{%else%}{% trans "Participate" %}{%endif%}'/>
 </form>
{% endblock %}