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 %} {% endif %}
{% if assignment.elected %} {% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.status != "fin" %}
<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 %}
{% if perms.assignment.can_manage_assignments and blocked_candidates %}
<h3>{% trans "Blocked Candidates" %}</h3> <h3>{% trans "Blocked Candidates" %}</h3>
<ul> <ul>
{% for person in blocked_candidates %} {% for person in blocked_candidates %}
@ -125,16 +116,6 @@
{% 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 %}

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 %}