summaryrefslogtreecommitdiff
path: root/papillon
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-03-25 18:43:47 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-03-25 18:43:47 +0100
commit1fe6a52803b4d78f57f52cdbe138010cc4c00f80 (patch)
tree3eb44592abefec9ab8a2ee0981eba4ada17d9a1a /papillon
parent3fcdf69304580650c6244165aae0b1fc46221cff (diff)
parent525fdda2aaae3adc8534ebda777dedddb17ef25f (diff)
downloadPapillon-1fe6a52803b4d78f57f52cdbe138010cc4c00f80.tar.bz2
Papillon-1fe6a52803b4d78f57f52cdbe138010cc4c00f80.zip
Merge branch 'responsive' of https://github.com/Trim/papillon into responsive
Conflicts: papillon/templates/base.html
Diffstat (limited to 'papillon')
-rw-r--r--papillon/static/styles.css83
-rw-r--r--papillon/templates/base.html34
-rw-r--r--papillon/templates/create.html46
-rw-r--r--papillon/templates/edit.html84
-rw-r--r--papillon/templates/editChoices.html28
-rw-r--r--papillon/templates/editChoicesAdmin.html67
-rw-r--r--papillon/templates/editChoicesUser.html24
-rw-r--r--papillon/templates/vote.html336
8 files changed, 409 insertions, 293 deletions
diff --git a/papillon/static/styles.css b/papillon/static/styles.css
index c918596..1b8ae7d 100644
--- a/papillon/static/styles.css
+++ b/papillon/static/styles.css
@@ -17,6 +17,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING for details.
*/
+@media only screen and (max-width: 600px){
+ #main{
+ width:100% !important;
+ background:white !important;
+ border:0px !important;
+ }
+
+ .new_poll{
+ width:100% !important;
+ }
+ .new_poll *{
+ padding:0 !important;
+ margin:0!important;
+ }
+}
+
/* colors */
body, #poll th, .highlight{
@@ -123,10 +139,11 @@ border:0;
#main{
background-color:white;
border:1px solid;
-margin:20px;
+margin:auto;
background-image: url(bg.jpg);
background-repeat:no-repeat;
background-position:95% 10%;
+width: 80%;
}
#header{
@@ -158,24 +175,46 @@ color:blue;
}
.new_poll{
-width:600px;
+ width:400px;
+ margin:auto;
+ padding:0;
+}
+
+.help_button{
+ float:right;
+ color:white;
+ background:green;
+ width:15px;
+ height:15px;
+ border-radius:25px;
+ text-align:center;
}
-.new_poll input{
-width:160px;
+.field_label{
+ clear:both;
+ font-size:1.5em;
+ width:100%;
+ float:none !important;
+ margin-top:10px;
}
-.new_poll .submit{
-width:auto;
+.new_poll table form tr {
+ margin:5px 0px !important;
+ padding:0px;
}
-.new_poll input.limit{
-width:20px;
+.new_poll div, .new_poll input, .new_poll textarea, .new_poll table{
+ width:100%;
+ margin:5px 0px;
}
-.new_poll textarea{
-width:160px;
-height:100px;
+.new_poll div {
+ float:left;
+}
+
+.errorlist, .error{
+ color:red;
+ background-color:rgb(255,200,200);
}
.datetime a img{
@@ -217,6 +256,7 @@ float:left;
#poll{
text-align:center;
+margin:auto;
}
#poll a{
@@ -274,7 +314,7 @@ color:white;
}
.footnote{
-font-size:10px;
+font-size:0.9em;
padding:10px;
}
@@ -295,7 +335,7 @@ padding:2px;
}
-.comments ul{
+ul.comments{
list-style-type:None;
margin:4px;
padding:0;
@@ -312,23 +352,6 @@ margin:0;
padding:0;
}
-.comments input{
-width:160px;
-}
-
-.comments textarea{
-width:160px;
-height:100px;
-}
-
-.comments #tdsubmit{
-text-align:center;
-}
-
-.comments .submit{
-width:auto;
-}
-
/* CALENDARS & CLOCKS IMPORTED FROM ADMIN */
diff --git a/papillon/templates/base.html b/papillon/templates/base.html
index c235686..af4a815 100644
--- a/papillon/templates/base.html
+++ b/papillon/templates/base.html
@@ -2,26 +2,26 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <link rel="stylesheet" href="{% static 'styles.css' %}" />
- <title>{% block title %}Papillon{% endblock %}</title>
- {% block fullscript %}{% endblock %}
+ <link rel="stylesheet" href="{% static 'styles.css' %}" />
+ <title>{% block title %}Papillon{% endblock %}</title>
+ {% block fullscript %}{% endblock %}
</head>
<body>
-<div id="main">
-<div id="header">
-<span id='languages'>{% for language in languages%}<a href='?language={{language.0}}'>{{language.1}}</a>{% endfor %}</span>
-</div>
-<div id="top">
- <h1><a href="{% url 'index' %}">Papillon</a></h1>
-</div>
-<div id="content">
-{% block content %}{% endblock %}
-</div>
-<div id="footer">
-<a href='http://blog.peacefrogs.net/nim/papillon/'>Papillon</a> - <a href='http://www.gnu.org/licenses/gpl.html'>Copyright</a> © 2008-2013 <a href='http://redmine.peacefrogs.net/projects/show/papillon'>Papillon project</a>
-</div>
-</div>
+ <div id="main">
+ <div id="header">
+ <span id='languages'>{% for language in languages%}<a href='?language={{language.0}}'>{{language.1}}</a>{% endfor %}</span>
+ </div>
+ <div id="top">
+ <h1><a href="{% url 'index' %}">Papillon</a></h1>
+ </div>
+ <div id="content">
+ {% block content %}{% endblock %}
+ </div>
+ <div id="footer">
+ <a href='http://blog.peacefrogs.net/nim/papillon/'>Papillon</a> - <a href='http://www.gnu.org/licenses/gpl.html'>Copyright</a> © 2008-2013 <a href='http://redmine.peacefrogs.net/projects/show/papillon'>Papillon project</a>
+ </div>
+ </div>
</body>
</html>
diff --git a/papillon/templates/create.html b/papillon/templates/create.html
index 224ae78..163ad17 100644
--- a/papillon/templates/create.html
+++ b/papillon/templates/create.html
@@ -8,26 +8,32 @@
{% block content %}
- <h2>{% trans "New poll" %}</h2>
-<form action="." method="post">
-<table class='new_poll'>
- {% for field in form %}
- {% if field.is_hidden %}
- {{field}}
- {% else %}
- <tr><td colspan='3'>{{field.errors}}</td></tr>
- <tr>
- <td>{{field.label_tag}}</td>
- <td>{{field}}</td>
- <td class='form_description'>{{field.help_text|markdown}}</td>
- </tr>
- {% endif %}
- {% endfor %}
- <tr>
- <td></td>
- <td><input type='submit' value='{% trans "Create" %}' class='submit'/></td>
- </tr>
-</table>
+<h2>{% trans "New poll" %}</h2>
+
+<form class="new_poll" action="." method="post">
+ {% csrf_token %}
+ {% for field in form %}
+ {% if field.is_hidden %}
+ {{field}}
+ {% else %}
+ <div class="field_label">
+ {{field.label_tag}}
+ <span class="help_button" title="{{field.help_text}}">?</span>
+ </div>
+ <div class="field_errors">
+ {% if field.errors %}
+ Error(s) :
+ <ol class="errorlist">
+ {% for error in field.errors %}
+ <li>{{ error|escape }}</li>
+ {% endfor %}
+ </ol>
+ {% endif %}
+ </div>
+ {{field}}
+ {% endif %}
+ {% endfor %}
+ <input style="clear:both;margin:auto;float:none;width:100%;" type='submit' value='{% trans "Create" %}' class='submit'/>
</form>
{% endblock %}
diff --git a/papillon/templates/edit.html b/papillon/templates/edit.html
index 647700d..5a33ebd 100644
--- a/papillon/templates/edit.html
+++ b/papillon/templates/edit.html
@@ -11,47 +11,49 @@
{% block content %}
<h2>{% trans "Edit poll" %}</h2>
-<form action="." method="post">
-<table class='new_poll'>
- <tr>
- <td><label>{% trans "Poll url" %}</label></td>
- <td>
-<a href="{% url 'poll' poll.base_url %}">{{ base_url }}</a>
- </td>
- <td class='form_description'><p>
-{% trans "Copy this address and send it to voters who want to participate to this poll" %}
- </p></td>
- </tr>
- <tr>
- <td><label>{% trans "Administration url" %}</label></td>
- <td>
-<a href="{% url 'edit' poll.admin_url %}">{{ edit_url }}</a>
- </td>
- <td class='form_description'><p>
- {% trans "Address to modify the current poll" %}
- </p></td>
- </tr>
- <tr>
- <td><label>{% trans "Choices administration url" %}</label></td>
- <td>
-<a href="{% url 'edit_choices_admin' poll.admin_url %}">{{choices_url }}</a>
- </td>
- <td class='form_description'><p>
- {% trans "Address to modify choices of the current poll." %}
- </p></td>
- </tr>
- {% for field in form %}
- {% if field.is_hidden %}
- {{field}}
- {% else %}
- <tr><td colspan='3'>{{field.errors}}</td></tr>
- <tr>
- <td>{{field.label_tag}}</td>
- <td>{{field}}</td>
- {% if field.help_text %}<td class='form_description'>{{field.help_text|markdown}}</td>{%endif%}
- </tr>
- {% endif %}
- {% endfor %}
+<form class='new_poll' action="." method="post">
+ {% csrf_token %}
+
+ <div class="field_label">
+ <label id="">{% trans "Poll url" %}</label>
+ <span class="help_button" title='{% trans "Copy this address and send it to voters who want to participate to this poll" %}'>?</span>
+ </div>
+ <input type="text" readonly value='{{ base_url }}'>
+
+ <div class="field_label">
+ <label id="">{% trans "Administration url" %}</label>
+ <span class="help_button" title='{% trans "Address to modify the current poll" %}'>?</span>
+ </div>
+ <input type="text" readonly value='{{ edit_url }}'>
+
+ <div class="field_label">
+ <label id="">{% trans "Choices administration url" %}</label>
+ <span class="help_button" title='{% trans "Address to modify choices of the current poll." %}'>?</span>
+ </div>
+ <input type="text" readonly value='{{choices_url }}'>
+
+ {% for field in form %}
+ {% if field.is_hidden %}
+ {{field}}
+ {% else %}
+
+ <div class="field_label">
+ {{field.label_tag}}
+ <span class="help_button" title="{{field.help_text}}">?</span>
+ </div>
+ <div class="field_errors">
+ {% if field.errors %}
+ Error(s) :
+ <ol class="errorlist">
+ {% for error in field.errors %}
+ <li>{{ error|escape }}</li>
+ {% endfor %}
+ </ol>
+ {% endif %}
+ </div>
+ {{field}}
+ {% endif %}
+ {% endfor %}
<tr>
<td></td>
<td><input type='submit' value='{% trans "Edit" %}' class='submit'/></td>
diff --git a/papillon/templates/editChoices.html b/papillon/templates/editChoices.html
index 7e059a8..9146e27 100644
--- a/papillon/templates/editChoices.html
+++ b/papillon/templates/editChoices.html
@@ -1,19 +1,19 @@
{% load markup %}
{% load i18n %}
-<h2>{% trans "New choice" %}</h2>
{%if form_new_choice.errors %} <p class='error'>{{form_new_choice.errors}}</p>{%endif%}
-<form action="." method="post">
-{{form_new_choice.poll}}
-{{form_new_choice.order}}
-<table class='new_poll'>
- <tr>
- <td class='form_description' colspan='3'><p>{% trans "Setting a new choice. Optionally you can set a limit of vote for this choice. This limit is usefull for limited resources allocation." %}</p></td>
- </tr>
- <tr>
- <td>{{form_new_choice.name}}</td>
- <td>{%trans "Limited to"%} {{form_new_choice.limit}} {%trans "vote(s)"%}</td>
- <td><input type='hidden' name='add' value='1'/> <input type='submit' value='{% trans "Add" %}' class='submit'/></td>
- </tr>
-</table>
+<form class='new_poll' action="." method="post">
+ {% csrf_token %}
+ <div class="field_label">
+ {% trans "Add new choice" %} <span class="help_button" title='{% trans "Setting a new choice. Optionally you can set a limit of vote for this choice. This limit is usefull for limited resources allocation." %}'>?</span>
+ </div>
+ {{form_new_choice.poll}}
+ {{form_new_choice.order}}
+
+ {%trans "Choice value:"%}<br/>
+ {{form_new_choice.name}}
+ {%trans "Max number of votes (optional):"%}<br/>
+ {{form_new_choice.limit}}<br/>
+ <input type='hidden' name='add' value='1'/>
+ <input type='submit' value='{% trans "Add" %}' class='submit'/>
</form>
diff --git a/papillon/templates/editChoicesAdmin.html b/papillon/templates/editChoicesAdmin.html
index d296a16..0a8c611 100644
--- a/papillon/templates/editChoicesAdmin.html
+++ b/papillon/templates/editChoicesAdmin.html
@@ -10,35 +10,50 @@
{% endblock %}
{% block content %}
-{% if not choices %}<p class='error'>
-{% blocktrans %}As long as no options were added to the poll, it will not be available.{% endblocktrans %}
-</p>{% else %}
-<h2>{% trans "Complete/Finalise the poll" %}</h2>
-<p><a href="{% url 'edit' poll.admin_url %}"><button>{% trans "Next"%}</button></a></p>
+{% if not choices %}
+ <p class='error'>
+ {% blocktrans %}As long as no options were added to the poll, it will not be available.{% endblocktrans %}
+ </p>
+{% else %}
+ <h2>{% trans "Choice administration" %}</h2>
+ <p>{% trans "After you've finished to add or edit choices for this poll, click on:" %} <a href="{% url 'edit' poll.admin_url %}"><button>{% trans "Next"%}</button></a></p>
{% endif %}
+
{% include 'editChoices.html' %}
+
{% if choices %}
-<h2>{% trans "Available choices" %}</h2>
-<table class='new_poll'>
- <tr>
- {%if not poll.dated_choices%}<th>{% trans "Up/down" %}</th>{%endif%}
- <th>{% trans "Label" %}</th>
- <th>{% trans "Limit" %}</th>
- <th>{% trans "Delete?"%}</th>
- </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>
- <td>{% trans "Limited to"%} {{choice.form.limit}} {% trans "vote(s)" %}</td>
- <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>
- </form>{% endfor %}
-</table>
+ <div class="new_poll" style="margin-top:20px;">
+ <div class="field_label">{% trans "Edit available choices" %}</div>
+ <div>
+ <table>
+ <tr>
+ {%if not poll.dated_choices%}<th style="word-wrap:none;">{% trans "Position" %}</th>{%endif%}
+ <th>{% trans "Value" %}</th>
+ <th>{% trans "Max votes" %}</th>
+ <th width="60px;">{% trans "Delete?"%} <span class="help_button" title='{% trans "To remove a choice, check this box on the good line and click on Edit."%}'>?</span></th>
+ </tr>
+ {% for choice in choices %}
+ <form action="." method="post">
+ {% csrf_token %}
+ {{choice.form.poll}}{{choice.form.order}}<tr>
+ {%if not poll.dated_choices%}
+ <td style="font-size:1.5em;">
+ <a href='?up_choice={{choice.id}}' class='arrow' title='{% trans "Move up" %}'>&uarr;</a>
+ <br/>
+ <a style="color:red;" href='?down_choice={{choice.id}}' title='{% trans "Move down" %}' class='arrow'>&darr;</a>
+ </td>
+ {%endif%}
+ <td>{{choice.form.name}}</td>
+ <td>{{choice.form.limit}}</td>
+ <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>
+ </form>{% endfor %}
+ </table>
+ </div>
+ </div>
+ <div style="clear:both"></div>
{% endif %}
{% endblock %}
diff --git a/papillon/templates/editChoicesUser.html b/papillon/templates/editChoicesUser.html
index 174c02f..958d05a 100644
--- a/papillon/templates/editChoicesUser.html
+++ b/papillon/templates/editChoicesUser.html
@@ -12,16 +12,20 @@
{% block content %}
<p><a href="{% url 'poll' poll.base_url %}">{%trans "Return to the poll"%}</a></p>
<h2>{% trans "Choices" %}</h2>
-{% if choices %}<table class='new_poll'>
- <tr>
- <th>{% trans "Label" %}</th>
- <th>{% trans "Limit" %}</th>
- </tr>
- {% for choice in choices %}<tr>
- <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 %}
-</table>
+{% if choices %}
+ <div class='new_poll'>
+ <div class='field_label'>{% trans "Current choices" %}</div>
+ <table>
+ <tr>
+ <th>{% trans "Name" %}</th>
+ <th>{% trans "Limit" %}</th>
+ </tr>
+ {% for choice in choices %}<tr>
+ <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 %}
+ </table>
+ </div>
{% endif %}
{% include 'editChoices.html' %}
{% endblock %}
diff --git a/papillon/templates/vote.html b/papillon/templates/vote.html
index 204f553..4ab70fe 100644
--- a/papillon/templates/vote.html
+++ b/papillon/templates/vote.html
@@ -10,139 +10,205 @@
{% 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|safe }}</p>
- <form method='post' action='.'>
- <div id='poll_table'>
- <table id='poll'>
- <tr>
- <td class='simple'></td>
- <td class='simple'></td>
- {% for choice in choices %}<th>{%if poll.dated_choices%}{{choice.date|date:"D d M Y H:i"}}{%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>
- {% 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 %}
- {% 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" %}
- {% 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 %}
- {% 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%}
- {%endif%}
- {%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 %}
- {% 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 %}
- </td>{%endfor%}
- </tr>
- {%endif%}{%endif%}
- {% if not hide_vote %}<tr id='sum'>
- <td class='simple'></td><th>{% trans "Sum" %}</th>
- {% for choice in choices %}<td{%if choice.highlight %} class='highlight'{%endif%}>{{choice.getSum}}</td>
- {% endfor %}
- </tr>{%endif%}
- {% if poll.open %}
- <td class='simple'></td>
- <td class='simple'><input type='submit' value='{%if current_voter_id%}{% trans "Edit" %}{%else%}{% trans "Participate" %}{%endif%}' class='submit'/></td>
- {% endif %}
- </table>
- </div>
- <hr class='spacer'/>
- </form>
- {%if poll.opened_admin%}
- <p><a href="{% url 'edit_choices_user' 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="../../feeds/poll/{{poll.base_url}}">{%trans "syndication"%}</a></p>{%endif%}
- </div>
-{%if not hide_vote and max_comment_nb %}
-<h3>{%trans "Comments"%} ({% blocktrans %}{{max_comment_nb}} max{% endblocktrans %})</h3>
-<div class='comments'>
- {%if poll.open and max_comment_nb > poll.comments.count %}<form method='post' action='.'>
- <table class='comment'>
- <tr>
- <td><label for='comment_author'>{% trans "Author name" %}</label></td>
- <td><input type='text' id='comment_author' name='comment_author'/></td>
- </tr>
- <tr>
- <td><label for='comment'>{% trans "Comment"%}</label></td>
- <td><textarea id='comment' name='comment' cols='' rows=''></textarea></td>
- </tr>
- <tr><td colspan='2' id='tdsubmit'><input type='submit' class='submit' value='{% trans "Send" %}'/></td></tr>
- </table>
-</form>{%endif%}
- <ul>{%for comment in comments%}
- <li><p class='author'>{{comment.author_name}}, {{comment.date|date:_("DATETIME_FORMAT")}} :</p>
- {{comment.text|safe}}</li>{%endfor%}
- </ul>
-</div>{%endif%}
+ <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 %}
+
+ <h3>{% trans "Description" %}</h3>
+ <p>{{ poll.description|safe }}</p>
+
+ <h3>{% trans "Participation" %}</h3>
+ <form method='post' action='.'>
+ {% csrf_token %}
+ <div id='poll_table'>
+ <table id='poll'>
+ <tr>
+ <td class='simple'></td>
+ <td class='simple'></td>
+ {% for choice in choices %}
+ <th>
+ {%if poll.dated_choices%}
+ {{choice.date|date:"D d M Y H:i"}}
+ {%else%}
+ {{choice.name}}
+ {%endif%}
+ {% if choice.limit %}
+ ({% trans "max" %} {{choice.limit}})
+ {%endif%}
+ </th>
+ {% endfor %}
+ </tr>
+ <!-- Show voter and vote lines if votes aren't hidden -->
+ {% 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>
+ {% 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 %}
+ {% 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" %}
+ {% 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 %}
+ {% 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%} <!-- End for loop on voters-->
+ {%endif%} <!-- End if hide vote-->
+
+ <!-- Show line to add a new voter and votes -->
+ {%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 %}
+ {% 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 %}
+ </td>
+ {%endfor%}
+ </tr>
+ {%endif%}<!-- End if poll.open -->
+ {%endif%}<!-- End if not current_voter_id -->
+
+ <!-- Show total line if votes aren't hidden -->
+ {% if not hide_vote %}
+ <tr id='sum'>
+ <td class='simple'></td>
+ <th>{% trans "Sum" %}</th>
+ {% for choice in choices %}
+ <td{%if choice.highlight %} class='highlight'{%endif%}>{{choice.getSum}}</td>
+ {% endfor %}
+ </tr>
+ {%endif%}
+
+ <!-- Show button to edit/participate-->
+ {% if poll.open %}
+ <tr>
+ <td class='simple'></td>
+ <td class='simple'>
+ <input type='submit' value='{%if current_voter_id%}{% trans "Edit" %}{%else%}{% trans "Participate" %}{%endif%}' class='submit'/>
+ </td>
+ </tr>
+ {% endif %}
+ </table> <!-- End poll table -->
+ </div><!-- End poll_table div -->
+ <hr class='spacer'/>
+ </form>
+
+ {%if poll.opened_admin%}
+ <p><a href="{% url 'edit_choices_user' 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="../../feeds/poll/{{poll.base_url}}">{%trans "RSS syndication"%}</a>
+ </p>
+ {%endif%}
+ </div>
+
+ {%if not hide_vote and max_comment_nb %}
+ <h3>{%trans "Comments"%} ({% blocktrans %}{{max_comment_nb}} max{% endblocktrans %})</h3>
+ <ul class='comments'>
+ {%for comment in comments%}
+ <li>
+ <p class='author'>{{comment.author_name}}, {{comment.date|date:_("DATETIME_FORMAT")}} :</p>
+ {{comment.text|safe}}
+ </li>
+ {%endfor%}
+ </ul>
+ {%if poll.open and max_comment_nb > poll.comments.count %}
+ <form class="new_poll" method='post' action='.'>
+ <div class="field_label">{% trans "Add a comment"%}</div>
+ <div class="field_label">
+ <label for='comment_author'>{% trans "Author name" %}</label>
+ </div>
+ <input type='text' id='comment_author' name='comment_author'/>
+ <div class="field_label">
+ <label for='comment'>{% trans "Comment"%}</label>
+ </div>
+ <textarea id='comment' name='comment' cols='' rows=''></textarea>
+ <input type='submit' class='submit' value='{% trans "Send" %}'/>
+ </form>
+ {%endif%}
+ {%endif%}
{% endblock %}