Restructuring and optimization of assignment templates.

(Now: elected candidates are marked in candidate list; blocked candidates not visible for status 'finished')
This commit is contained in:
Emanuel Schuetze 2012-11-19 22:54:09 +01:00
parent 0cf4191934
commit 93d2dc8d7d
3 changed files with 17 additions and 39 deletions

View File

@ -32,10 +32,11 @@
{% if assignment.active %}activeline{% endif %}"> {% if assignment.active %}activeline{% endif %}">
<td><a href="{% url assignment_view assignment.id %}">{{ assignment }}</a></td> <td><a href="{% url assignment_view assignment.id %}">{{ assignment }}</a></td>
<td> <td>
{{ assignment.posts }} {% trans "posts" %} / {{ assignment.elected|length }} {% trans "elected" %} {% trans "posts" %}: {{ assignment.posts }}
{% if assignment.status != 'fin' %} {% if assignment.status != 'fin' %}
/ {{ assignment.candidates|length }} {% trans "candidates" %} | {% trans "candidates" %}: {{ assignment.get_participants|length }}
{% endif %} {% endif %}
| {% trans "elected" %}: {{ assignment.elected|length }}
</td> </td>
<td>{{ assignment.get_status_display }}</td> <td>{{ assignment.get_status_display }}</td>
<td> <td>

View File

@ -33,9 +33,10 @@
<h1>{{ assignment }}</h1> <h1>{{ assignment }}</h1>
<p>{{ assignment.description|linebreaks }}</p> <p>{{ assignment.description|linebreaks }}</p>
{% if assignment.status != "fin" %}
<h3>{% trans "Candidates" %}</h3> <h3>{% trans "Candidates" %}</h3>
<ol> <ol>
{% for person in assignment.candidates %} {% for person in assignment.get_participants %}
<li> <li>
{{ person }} {{ person }}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
@ -43,6 +44,14 @@
<a href="{% url assignment_delother assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a> <a href="{% url assignment_delother assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if person in assignment.elected %}
| <b>{% trans "elected" %}</b>
{% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url assignment_user_not_elected assignment.id person.person_id %}"><img src="{% static 'images/icons/dialog-cancel.png' %}" title="{% trans 'Mark candidate as not elected' %}"></a>
{% endif %}
{% endif %}
{% endif %}
</li> </li>
{% empty %} {% empty %}
<li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li> <li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li>
@ -85,29 +94,11 @@
</p> </p>
{% endif %} {% endif %}
</form> </form>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if assignment.elected %}
<h3>{% trans "Elected Candidates" %}</h3>
<ul>
{% for person in assignment.elected %}
<li>
{{ person }}
{% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url assignment_user_not_elected assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a>
{% endif %}
{% endif %}
</li>
{% empty %}
<li>{% trans "No elected candidates available." %}</li>
{% endfor %}
</ul>
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignments and blocked_candidates %} {% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.status != "fin" %}
<h3>{% trans "Blocked Candidates" %}</h3> <h3>{% trans "Blocked Candidates" %}</h3>
<ul> <ul>
{% for person in blocked_candidates %} {% for person in blocked_candidates %}
@ -123,18 +114,8 @@
{% if assignment.status != "sea" %} {% if assignment.status != "sea" %}
<h3>{% trans "Election results" %}</h3> <h3>{% trans "Election results" %}</h3>
{% if polls.exists %} {% if polls.exists %}
<table id="election_table" style="width: auto;"> <table id="election_table" style="width: auto;">
<tr>
<th></th>
{% with ballotnumber=polls.count %}
<th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
{% trans "ballot" %}
</th>
{% endwith %}
</tr>
<tr> <tr>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
{% for poll in polls %} {% for poll in polls %}
@ -235,7 +216,7 @@
{% endif %} {% endif %}
</tr> </tr>
</table> </table>
{% else %} {% else %}
<i>{% trans "No results available." %}</i> <i>{% trans "No results available." %}</i>
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<p><a href='{% url assignment_gen_poll assignment.id %}'> <p><a href='{% url assignment_gen_poll assignment.id %}'>
@ -244,7 +225,7 @@
</span> </span>
</a></p> </a></p>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -120,10 +120,6 @@
</td> </td>
{% endfor %} {% endfor %}
</tr> </tr>
</table> </table>
{% elif some_polls_available %}
<i>{% trans "Vote results are not published yet." %}</i>
{% endif %} {% endif %}
<br>
{% endblock %} {% endblock %}