summaryrefslogtreecommitdiff
path: root/templates/vote.html
diff options
context:
space:
mode:
authoretienne2008-08-24 22:18:42 +0000
committeretienne2008-08-24 22:18:42 +0000
commitedd1bad62b445b0cae291f0406e7d0ca1eabf5ae (patch)
tree756cef4ae2ebcd104e2cb5e7e8bc958b547126cd /templates/vote.html
parent95c2f32086b98edcdc1121bb936cfdefa1ee33bf (diff)
Update of the model. Sort vote by creation date (#15). Update of poll information (#13). New poll types (#2, #5)
Diffstat (limited to 'templates/vote.html')
-rw-r--r--templates/vote.html34
1 files changed, 24 insertions, 10 deletions
diff --git a/templates/vote.html b/templates/vote.html
index 27e54a3..566bb8e 100644
--- a/templates/vote.html
+++ b/templates/vote.html
@@ -11,32 +11,40 @@
<tr>
<td class='simple'></td>
<td class='simple'></td>
- {% for choice in choices %}<th>{{choice.name}}</th>
+ {% for choice in choices %}<th>{{choice.name}}{% if choice.limit %} ({% trans "max" %} {{choice.limit}}){%endif%}</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>
+ <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='{%if vote.id%}vote_{{vote.id}}{%else%}choice_{{vote}}{%endif%}'{%ifequal vote.value 1%} checked='checked'{%endifequal%}/>
+ <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='{%if vote.id%}vote_{{vote.id}}{%else%}choice_{{vote}}{%endif%}'>
+ <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}}</option>
{% endfor %}
</select>
{% endifequal %}
+ {% else %}
+ {% trans "Limit reached" %}
+ {% endif %}
</td>{%endfor%}
{%else%}<td class='simple'><a href='?voter={{voter.id}}'>{% trans "Edit" %}</a></td>
- <td>{{voter.name}}</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 'P'%}
- {%ifequal vote.value 0%}{% trans "No" %}{%else%}{% trans "Yes" %}{%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}}{%endifequal%}{%endfor%}
+ {%ifequal VOT.0 vote.value%}{{VOT.1.0}}{%endifequal%}{%endfor%}
{%endifequal%}
</td>
{%endfor%}
@@ -47,19 +55,25 @@
<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}}</option>{% endfor %}
+ <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%}
<tr id='sum'>
<td class='simple'></td><th>{% trans "Sum" %}</th>
- {% for sum in choices_sum %}<td>{{sum}}</td>
+ {% for choice in choices %}<td>{{choice.sum}}</td>
{% endfor %}
</tr>
</table>