diff options
| author | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2009-12-04 22:58:19 +0000 |
|---|---|---|
| committer | etienne <etienne@07715635-78ed-41b0-aaf1-0afda6c37f35> | 2009-12-04 22:58:19 +0000 |
| commit | 6cab9442e9ada9c15879998d287bb549e2037238 (patch) | |
| tree | 1cef34f4e5d752713f1ea215f49f1557768b8ff3 /templates | |
| parent | 442d34494354cbca1cad022290db417ae7a7aede (diff) | |
| download | Papillon-6cab9442e9ada9c15879998d287bb549e2037238.tar.bz2 Papillon-6cab9442e9ada9c15879998d287bb549e2037238.zip | |
Template cleaning - Vote page upgrade with new fonctionnality
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/editChoicesAdmin.html | 10 | ||||
| -rw-r--r-- | templates/editChoicesUser.html | 10 | ||||
| -rw-r--r-- | templates/vote.html | 98 |
3 files changed, 74 insertions, 44 deletions
diff --git a/templates/editChoicesAdmin.html b/templates/editChoicesAdmin.html index a668319..260d68c 100644 --- a/templates/editChoicesAdmin.html +++ b/templates/editChoicesAdmin.html @@ -19,7 +19,6 @@ {% include 'editChoices.html' %} {% if choices %} <h2>{% trans "Available choices" %}</h2> -<form action="" method="post"> <table class='new_poll'> <tr> {%if not poll.dated_choices%}<th>{% trans "Up/down" %}</th>{%endif%} @@ -27,7 +26,9 @@ <th>{% trans "Limit" %}</th> <th>{% trans "Delete?"%}</th> </tr> - {% for choice in choices %}{{choice.form.poll}}{{choice.form.order}}<tr> + {% for choice in choices %} + <form action="" method="post"> + {{choice.form.poll}}{{choice.form.order}}<tr> {%if not poll.dated_choices%}<td><a href='?up_choice={{choice.id}}' class='arrow'>+</a> / <a href='?down_choice={{choice.id}}' class='arrow'>-</a></td>{%endif%} <td>{{choice.form.name}}</td> @@ -35,8 +36,9 @@ <td><input type='checkbox' name='delete_{{choice.id}}'/></td> <td><input type='hidden' name='edit' value='{{choice.id}}'/></td> <td><input type='submit' value='{% trans "Edit" %}' class='submit'/></td> - </tr>{% endfor %} + </tr> + </form>{% endfor %} </table> -</form>{% endif %} +{% endif %} {% endblock %} diff --git a/templates/editChoicesUser.html b/templates/editChoicesUser.html index bec7384..4313ade 100644 --- a/templates/editChoicesUser.html +++ b/templates/editChoicesUser.html @@ -10,6 +10,7 @@ {% endblock %} {% block content %} + <p><a href="http://{{root_url}}poll/{{poll.base_url}}/">{%trans "Return to the poll"%}</a></p> <h2>{% trans "Choices" %}</h2> {% if choices %}<table class='new_poll'> <tr> @@ -17,15 +18,10 @@ <th>{% trans "Limit" %}</th> </tr> {% for choice in choices %}<tr> - <td>{{choice.name}}</td> + <td>{%if poll.dated_choices%}{{choice.date|date:_("DATETIME_FORMAT")}}{%else%}{{choice.name}}{%endif%}</td> <td>{% if choice.limit %}{% trans "Limited to"%} {{choice.limit}} {% trans "vote(s)" %}{% endif %}</td> </tr>{% endfor %} - <tr> - <td></td> - <td><input type='hidden' name='edit' value='1'/> - <input type='submit' value='{% trans "Edit" %}' class='submit'/></td> - </tr> </table> -</form>{% endif %} +{% endif %} {% include 'editChoices.html' %} {% endblock %} diff --git a/templates/vote.html b/templates/vote.html index fbfbf7c..31ba7b0 100644 --- a/templates/vote.html +++ b/templates/vote.html @@ -1,55 +1,78 @@ {% extends "base.html" %} {% load i18n %} +{% load get_range %} + +{% block fullscript %} +<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script> +<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script> +<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script> +{{ form_comment.media }} +{% endblock %} {% block content %} <h2>{%if poll.category %}{{poll.category.name}} - {%endif%}{{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> + <p>{{ poll.description|safe }}</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> + {% for choice in choices %}<th>{%if poll.dated_choices%}{{choice.date|date:_("DATETIME_FORMAT")}}{%else%}{{choice.name}}{%endif%}{% if choice.limit %} ({% trans "max" %} {{choice.limit}}){%endif%}</th> {% endfor %}</tr> {% if not hide_vote %} {% 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> +{% 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}}'> + {% 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> + <option value='{{vote_choice.0}}'{%ifequal vote.value vote_choice.0%} selected='selected'{%endifequal%}>{{vote_choice.1.1}}</option> {% endfor %} - </select> - {% endifequal %} + </select> + {% endifequal %} + {% ifequal poll.type 'V' %} + <select name='vote_{{vote.id}}'> + {% for vote_choice in 10|get_range %} + <option value='{{vote_choice}}'{%ifequal vote.value vote_choice%} selected='selected'{%endifequal%}>{{vote_choice}}</option> + {% endfor %} + </select> + {% endifequal %} {% else %} - {% trans "Limit reached" %} + {% trans "Limit reached" %} {% endif %} - </td>{%endfor%} - {%else%}<td class='simple'>{% if poll.open %}<a href='?voter={{voter.id}}'>{% trans "Edit" %}</a>{%else%} {%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> + </td> + {%endfor%} +{%else%} + <td class='simple'>{% if poll.open %}<a href='?voter={{voter.id}}'>{% trans "Edit" %}</a>{%else%} {%endif%}</td> + <td>{{voter.user.name}}</td> + {% for vote in voter.votes %} + {% ifequal poll.type 'V' %} + <td class='{%ifequal vote.value 9%}OK{%else%}{%ifequal vote.value 0%}KO{%else%}OKO{%endifequal%}{%endifequal%}'> + {%if vote.value%}{{vote.value}}{%else%}0{%endif%}</td> + {% else %} + <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> + {% endifequal %} {%endfor%} {%endifequal%} </tr>{%endfor%} @@ -69,6 +92,13 @@ <option value='{{vote_choice.0}}'{%ifequal vote_choice.0 0%} selected='selected'{%endifequal%}>{{vote_choice.1.1}}</option>{% endfor %} </select> {% endifequal %} + {% ifequal poll.type 'V' %} + <select name='choice_{{choice.id}}'> + {% for vote_choice in 10|get_range %} + <option value='{{vote_choice}}'>{{vote_choice}}</option> + {% endfor %} + </select> + {% endifequal %} {% else %} {% trans "Limit reached" %} {% endif %} @@ -88,6 +118,8 @@ </div> <hr class='spacer'/> </form> + {%if poll.opened_admin%} + <p><a href="http://{{root_url}}editChoicesUser/{{poll.base_url}}/">{%trans "Add a new choice to this poll?"%}</a></p>{%endif%} <div class='footnote'> {%if hide_vote%}<p>{% trans "You have already vote? You are enough wise not to be influenced by other votes? You can display result by clicking" %} <a href='?display_result=1'>{% trans "here" %}</a>.</p>{%else%} <p>{% trans "Remain informed of poll evolution:" %} <a href="http://{{root_url}}feeds/poll/{{poll.base_url}}/">{%trans "syndication"%}</a></p>{%endif%} @@ -110,7 +142,7 @@ </form>{%endif%} <ul>{%for comment in comments%} <li><p class='author'>{{comment.author_name}}, {{comment.date|date:_("DATETIME_FORMAT")}} :</p> - <pre>{{comment.text}}</pre></li>{%endfor%} + {{comment.text|safe}}</li>{%endfor%} </ul> </div>{%endif%} -{% endblock %}
\ No newline at end of file +{% endblock %} |
