summaryrefslogtreecommitdiff
path: root/templates/vote.html
blob: 803813edd0dfea9f7f85b4ed323f9704e5c79afa (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{% extends "base.html" %}
{% load i18n %}

{% block content %}
 <h2>{{poll_type_name}} - {{poll.name}}</h2>
{% if error %}<p class='alert'>{{ error }}</p>{% endif %}
{% if not poll.open %}<p class='alert'>{% trans "The current poll is closed."%}</p>{% endif %}
 <p>{{ poll.description }}</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}}{% if choice.limit %} ({% trans "max" %} {{choice.limit}}){%endif%}</th>
 {% endfor %}</tr>
 {% for voter in voters %}<tr{% if voter.highlight %} class='highlighted_voter'{% endif %}>
 {% 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.user.name}}'/></td>
  {% for vote in voter.votes %}<td>
  {% if vote.choice.available or vote.value %}
  {% ifequal poll.type 'P' %}
  <input type='checkbox' name='vote_{{vote.id}}'{%ifequal vote.value 1%} checked='checked'{%endifequal%}/>
  {% endifequal %}
  {% ifequal poll.type 'O' %}
  <input type='radio' name='vote' value='{{vote.id}}' {%ifequal vote.value 1%} checked='checked'{%endifequal%}/>
  {% endifequal %}
  {% ifequal poll.type 'B' %}
  <select name='vote_{{vote.id}}'>
    {% for vote_choice in VOTE %}
    <option value='{{vote_choice.0}}'{%ifequal vote.value vote_choice.0%} selected='selected'{%endifequal%}>{{vote_choice.1.1}}</option>
    {% endfor %}
  </select>
  {% endifequal %}
  {% else %}
  {% trans "Limit reached" %}
  {% endif %}
  </td>{%endfor%}
  {%else%}<td class='simple'>{% if poll.open %}<a href='?voter={{voter.id}}'>{% trans "Edit" %}</a>{%else%}&nbsp;{%endif%}</td>
  <td>{{voter.user.name}}</td>
  {% for vote in voter.votes %}<td class='{%ifequal vote.value 1%}OK{%else%}{%ifequal vote.value 0%}OKO{%else%}KO{%endifequal%}{%endifequal%}'>
  {%ifequal poll.type 'B'%}
  {%for VOT in VOTE%}
  {%ifequal VOT.0 vote.value%}{{VOT.1.1}}{%endifequal%}{%endfor%}
  {%else%}
  {%for VOT in VOTE%}
  {%ifequal VOT.0 vote.value%}{{VOT.1.0}}{%endifequal%}{%endfor%}
  {%endifequal%}
  </td>
  {%endfor%}
  {%endifequal%}
 </tr>{%endfor%}
 {%if not current_voter_id%}
 {% if poll.open %}
 <tr>
  <td class='simple'></td>
  <td><input type='text' name='author_name'/></td>
  {%for choice in choices%}<td>
  {% if choice.available %}
  {% ifequal poll.type 'P' %}
  <input type='checkbox' name='choice_{{choice.id}}'/>{% endifequal %}
  {% ifequal poll.type 'O' %}
  <input type='radio' name='choice' value='{{choice.id}}'/>{% endifequal %}
  {% ifequal poll.type 'B' %}
  <select name='choice_{{choice.id}}'>{% for vote_choice in VOTE %}
    <option value='{{vote_choice.0}}'{%ifequal vote_choice.0 0%} selected='selected'{%endifequal%}>{{vote_choice.1.1}}</option>{% endfor %}
  </select>
  {% endifequal %}
  {% else %}
  {% trans "Limit reached" %}
  {% endif %}
  </td>{%endfor%}
 </tr>
 {%endif%}
 {%endif%}
 <tr id='sum'>
  <td class='simple'></td><th>{% trans "Sum" %}</th>
  {% for choice in choices %}<td{%if choice.highlight %} class='highlight'{%endif%}>{{choice.sum}}</td>
  {% endfor %}
 </tr>
 </table>
 {% if poll.open %}
 <input type='submit' value='{%if current_voter_id%}{% trans "Edit" %}{%else%}{% trans "Participate" %}{%endif%}'/>
 {% endif %}
 </div>
 <hr class='spacer'/>
 </form>
 <div id='syndication'>
  {% trans "Remain informed of poll evolution:" %} <a href="/papillon/feeds/poll/{{poll.base_url}}/">{%trans "Syndication"%}</a>
 </div>
{% endblock %}