diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/createOrEdit.html | 57 | ||||
| -rw-r--r-- | templates/vote.html | 34 |
2 files changed, 60 insertions, 31 deletions
diff --git a/templates/createOrEdit.html b/templates/createOrEdit.html index 4eecaa2..0c223ff 100644 --- a/templates/createOrEdit.html +++ b/templates/createOrEdit.html @@ -7,58 +7,73 @@ {% endif %} <h2>{% if new %}{% trans "New poll" %}{% else %}{% trans "Edit poll" %}{% endif %}</h2> {% if error %}<p class='error'>{{ error }}</p>{% endif %} - <form action="{{admin_url}}" method="post"> - <table id='new_poll'> +<table id='new_poll'> +<form action="{{admin_url}}" method="post"> {% if not new %}<tr> <td><label>{% trans "Poll url" %}</label></td> - <td><a href='http://{{full_base_url}}'>http://{{full_base_url}}</a></td> + <td colspan='2'><a href='http://{{full_base_url}}'>http://{{full_base_url}}</a></td> <td class='form_description'>{% trans "Copy this address and send it to voters who want to participate to this poll" %}</td> </tr> <tr> <td><label>{% trans "Administration url" %}</label></td> - <td><a href='http://{{full_admin_url}}'>http://{{full_admin_url}}</a></td> + <td colspan='2'><a href='http://{{full_admin_url}}'>http://{{full_admin_url}}</a></td> <td class='form_description'>{% trans "Address to modify the current poll" %}</td> </tr> {% endif %}<tr> <td><label for='author_name'>{% trans "Author name" %}</label></td> - <td>{% if new %}<input type='text' name='author_name' value='{{author_name}}'/>{% else %}{{author_name}}{% endif %}</td> + <td colspan='2'>{% if new %}<input type='text' name='author_name' value='{{author_name}}'/>{% else %}{{author_name}}{% endif %}</td> <td class='form_description'>{% trans "Name, firstname or nickname of the author" %}</td> </tr> <tr> <td><label for='poll_name'>{% trans "Poll name" %}</label></td> - <td>{% if new %}<input type='text' name='poll_name' value='{{poll_name}}'/>{% else %}{{poll_name}}{% endif %}</td> + <td colspan='2'>{% if new %}<input type='text' name='poll_name' value='{{poll_name}}'/>{% else %}<input type='text' name='poll_name' value='{{poll_name}}'/>{% endif %}</td> <td class='form_description'>{% trans "Global name to present the poll" %}</td> </tr> <tr> <td><label for='poll_desc'>{% trans "Poll description" %}</label></td> - <td>{% if new %}<textarea name='poll_desc'>{{poll_desc}}</textarea>{% else %}{{poll_desc}}{% endif %}</td> + <td colspan='2'>{% if new %}<textarea name='poll_desc'>{{poll_desc}}</textarea>{% else %}<textarea name='poll_desc'>{{poll_desc}}</textarea>{% endif %}</td> <td class='form_description'>{% trans "Precise description of the poll" %}</td> </tr> <tr> <td><label for='poll_type'>{% trans "Poll type" %}</label></td> - <td>{% if new %}<select name='poll_type'> + <td colspan='2'>{% if new %}<select name='poll_type'> {% for typ in TYPES %}<option value='{{typ.0}}'{% ifequal poll_type typ.0%} selected='selected'{% endifequal %}>{{typ.1}}</option>{% endfor %} </select>{% else %}{{type_name}}{% endif %}</td> <td class='form_description'>{% trans "Type of the poll:" %} <ul> <!--<li>{% trans "Meeting is the appropriate type to set a date for a meeting."%}</li>!--> - <li>{% trans "Poll is the appropriate type for a simple multi-choice poll" %}</li> - <li>{% trans "Balanced poll lets voters setting negative vote for some choices" %}</li> - <!--<li>{% trans "One choice poll" %}</li>!--> + <li>{% trans '"Poll" is the appropriate type for a simple multi-choice poll' %}</li> + <li>{% trans '"Balanced poll" lets voters setting negative vote for some choices' %}</li> + <li>{% trans '"One choice poll"' %}</li> </ul> </td> </tr> - {% if not new %}{% if choices %}<tr> - <th>{% trans "Choices" %}</th><th> </th><th>{% trans "Delete?"%}</th> + {% if choices %}<tr> + <th>{% trans "Choices" %}</th><th>{% trans "Label" %}</th><th>{% trans "Limit" %}</th><th>{% trans "Delete?"%}</th> </tr> {% for choice in choices %}<tr> - <td> </td><td>{{choice.name}}</td><td><input type='checkbox' name='delete_{{choice.id}}'/></td> + <td> </td><td>{{choice.name}}</td><td>{%if choice.limit%}{% blocktrans with choice.limit as choice_limit%}Limited to {{choice_limit}} vote(s){% endblocktrans %}{%endif%}</td><td><input type='checkbox' name='delete_{{choice.id}}'/></td> + </tr> + {% endfor %}{% endif %} + <tr> + <td></td> + <td>{% if new %}<input type='hidden' name='new' value='1'/> + <input type='submit' value='{% trans "Create" %}' /> + {% else %}<input type='hidden' name='edit' value='1'/> + <input type='submit' value='{% trans "Edit" %}' /> + {% endif %}</td> </tr> - {% endfor %}{% endif %}<tr><td><label>{% trans "New choice" %}</label></td><td><input type='text' name='new_choice'/></td></tr> - {% endif %}</table> - {% if new %}<input type='hidden' name='new' value='1'/> - <input type='submit' value='{% trans "Create" %}' /> - {% else %}<input type='hidden' name='edit' value='1'/> - <input type='submit' value='{% trans "Edit" %}' /> - {% endif %}</form> + </form> +{% if new %} +</table> +{% else %} + <form action="{{admin_url}}" method="post"> + <tr><td><label>{% trans "New choice" %}</label></td><td><input type='text' name='new_choice'/></td><td>{%trans "Limited to"%} <input type='text' name='limit' id='limit'/> {%trans "vote(s)"%}</td><td class='form_description'>{% trans "Setting a new choice. Optionally you can set a limit of vote for this choice. This limit is usefull for limited resources allocation." %}</td></tr> + <tr> + <td></td> + <td><input type='hidden' name='add' value='1'/> <input type='submit' value='{% trans "Add" %}' /></td> + </tr> + </form> +</table> + {% endif %} {% endblock %} 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> |
