This commit is contained in:
Oskar Hahn 2012-07-04 02:43:46 +02:00
commit ad8d5585f1
5 changed files with 125 additions and 115 deletions

View File

@ -32,7 +32,7 @@
{% for p in item.get_ancestors %} {% for p in item.get_ancestors %}
<span class="indentation">&nbsp;</span> <span class="indentation">&nbsp;</span>
{% endfor %} {% endfor %}
<a href="{% model_url item 'view' %}">{{ item }}</a> <a href="{% model_url item 'view' %}">{{ item }}</a>{% if item.releated_sid %} ({{ item.print_releated_type }}){% endif %}
{% if not item.is_leaf_node %} {% if not item.is_leaf_node %}
<a class="activate_link" href="{% url projector_activate_slide item.sid 'summary' %}"><img src="{% static 'images/icons/view-list-tree.png' %}" title="{% trans 'Activate summary for this item' %}"></a> <a class="activate_link" href="{% url projector_activate_slide item.sid 'summary' %}"><img src="{% static 'images/icons/view-list-tree.png' %}" title="{% trans 'Activate summary for this item' %}"></a>
{% endif %} {% endif %}

View File

@ -204,11 +204,13 @@
{% endif %} {% endif %}
</h1> </h1>
{% trans "Version" %} {{ version.aid }} {% trans "Version" %} {{ version.aid }}
{% if application.public_version != application.last_version %} {% if application.public_version != application.last_version %}
&#8901;
{% if version == application.public_version %} {% if version == application.public_version %}
(<a href="{% url application_view_newest application.id %}">{% trans "Show newest Version" %}</a>) {% trans "This is not the newest version." %} <a href="{% url application_view_newest application.id %}">{% trans "Go to version" %} {{ application.last_version.aid }}.</a>
{% else %} {% else %}
(<a href="{% url application_view application.id %}">{% trans "Show permitted Version" %}</a>) {% trans "This is not the permitted version." %} <a href="{% url application_view application.id %}">{% trans "Go to version" %} {{ application.public_version.aid }}.</a>
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@ -157,7 +157,7 @@ class Assignment(models.Model, SlideMixin):
data['assignment'] = self data['assignment'] = self
data['title'] = self.name data['title'] = self.name
data['polls'] = self.poll_set.all() data['polls'] = self.poll_set.all()
data['votes'] = self.vote_results data['vote_results'] = self.vote_results
data['template'] = 'projector/Assignment.html' data['template'] = 'projector/Assignment.html'
return data return data

View File

@ -99,6 +99,7 @@
{% if polls %} {% if polls %}
<table id="election_table" style="width: auto;"> <table id="election_table" style="width: auto;">
<tr> <tr>
<th></th> <th></th>
{% with ballotnumber=polls.count %} {% with ballotnumber=polls.count %}
@ -107,24 +108,25 @@
</th> </th>
{% endwith %} {% endwith %}
</tr> </tr>
<tr> <tr>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
{% for poll in polls %} {% for poll in polls %}
{# if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment #} {% if poll.published or perms.assignment.can_manage_assignment %}
<th style="vertical-align: top; white-space:nowrap;"> <th style="vertical-align: top; white-space:nowrap;">
{{ forloop.counter }}. {% trans 'ballot' %} {{ forloop.counter }}. {% trans 'ballot' %}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
<br> <br>
<a class="publish_link {% if poll.published %}published{% endif %}" <a class="publish_link {% if poll.published %}published{% endif %}"
href="{% url assignment_poll_publish_status poll.id %}" href="{% url assignment_poll_publish_status poll.id %}"
title="{%trans 'Publish/unpublish results' %}"> title="{%trans 'Publish/unpublish results' %}">
<span></span> <span></span>
</a> </a>
<a href="{% url assignment_poll_view poll.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit' %}"></a> <a href="{% url assignment_poll_view poll.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit' %}"></a>
<a href="{% url assignment_poll_delete poll.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete' %}"></a> <a href="{% url assignment_poll_delete poll.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete' %}"></a>
{% endif %} {% endif %}
</th> </th>
{# endif #} {% endif %}
{% endfor %} {% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<th> <th>
@ -136,46 +138,51 @@
</th> </th>
{% endif %} {% endif %}
</tr> </tr>
{% for candidate, votes in vote_results.items %} {% for candidate, votes in vote_results.items %}
<tr class="{% cycle 'odd' '' %}"> <tr class="{% cycle 'odd' '' %}">
<td class="candidate"> <td class="candidate">
{% if candidate in assignment.elected.all %} {% if candidate in assignment.elected.all %}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
<a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.id %}'></a> <a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.id %}'></a>
{% else %}
<a class="elected"><img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{% else %} {% else %}
{% if perms.assignment.can_manage_assignment %} <a class="elected"><img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"></a>
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.id %}'></a>
{% endif %}
{% endif %} {% endif %}
{{ candidate }} {% else %}
</td> {% if perms.assignment.can_manage_assignment %}
{% for vote in votes %} <a class="election_link" href='{% url assignment_user_elected assignment.id candidate.id %}'></a>
{% endif %}
{% endif %}
{{ candidate }}
</td>
{% for vote in votes %}
{% if perms.assignment.can_manage_assignment %}
{# Hier stimmt es noch nicht. Es muss rein, dass veröffentlichte Wahlergebnisse für jedermann sichtbar sind #}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if vote %} {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} <img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if vote.Yes %}{{ vote.Yes }}{% else %}&empty;{% endif %}<br> <img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {% if vote.No %}{{ vote.No }}{% else %}&empty;{% endif %}<br> <img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {% if vote.Abstain %}{{ vote.Abstain }}{% else %}&empty;{% endif %}<br> {% elif 'Votes' in vote %}
{% elif 'Votes' in vote %} <img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if vote.Votes %}{{ vote.Votes }}{% else %}&empty;{% endif %} {% elif vote == None %}
{% endif %} {% trans 'was not a <br> candidate'%}
{% else %} {% else %}
&nbsp;
{% endif %} {% endif %}
</td> </td>
{% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %} {% endif %}
</tr> {% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
{% endfor %} {% endfor %}
<tr> <tr>
<td>{%trans 'Invalid votes' %}</td> <td>{%trans 'Invalid votes' %}</td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %} {% if poll.published or perms.assignment.can_manage_assignment %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td> <td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -183,10 +190,11 @@
<td></td> <td></td>
{% endif %} {% endif %}
</tr> </tr>
<tr class="total"> <tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td> <td><strong>{%trans 'Votes cast' %}</strong></td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %} {% if poll.published or perms.assignment.can_manage_assignment %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <strong>{{ poll.print_votescast }}</strong></td> <td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <strong>{{ poll.print_votescast }}</strong></td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -27,88 +27,88 @@
{% block scrollcontent %} {% block scrollcontent %}
{% if not assignment.profile.exists %} {% if not assignment.profile.exists %}
<p> <p>
<div class="text">{{ assignment.description|linebreaks }}</div> <div class="text">{{ assignment.description|linebreaks }}</div>
</p> </p>
{% endif %} {% endif %}
{% if assignment.profile.exists and assignment.status != "fin" %} {% if assignment.profile.exists and assignment.status != "fin" %}
<h3>{% trans "Candidates" %}</h3> <h3>{% trans "Candidates" %}</h3>
<ol> <ol>
{% for profile in assignment.profile.all|dictsort:"user.first_name" %} {% for profile in assignment.profile.all|dictsort:"user.first_name" %}
<li>{{ profile }} </li> <li>{{ profile }} </li>
{% empty %} {% empty %}
<li style="list-style: none outside none;"> <li style="list-style: none outside none;">
<i>{% trans "No candidates available." %}</i> <i>{% trans "No candidates available." %}</i>
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
<p><br></p> <p><br></p>
{% endif %} {% endif %}
{% if polls.exists %} {% if polls.exists %}
<h3>{% trans "Election results" %}</h3> <h3>{% trans "Election results" %}</h3>
<table> <table>
<tr>
<th>{% trans "Candidates" %}</th> <tr>
{% for poll in assignment.poll_set.all %} <th>{% trans "Candidates" %}</th>
{% if poll.published %} {% for poll in assignment.poll_set.all %}
<th><nobr>{{forloop.counter}}. {% trans "ballot" %}</nobr></th> {% if poll.published %}
{% endif %} <th><nobr>{{forloop.counter}}. {% trans "ballot" %}</nobr></th>
{% endfor %}
</tr>
{% for vote in votes %}
<tr class="{% cycle 'odd' '' %}">
{% with vote|first as candidate %}
<td class="candidate{% if candidate.1 %} elected{% endif %}">
{% if candidate.1 %}
<a class="elected">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
</a>
{% endif %} {% endif %}
{{ candidate.0 }} {% endfor %}
</td> </tr>
{% for v in vote|last %}
<td style="white-space:nowrap;" {% if candidate.1 %}class="elected"{% endif %}> {% for candidate, votes in vote_results.items %}
{% if v %} <tr class="{% cycle 'odd' '' %}">
{% if v|length == 3 %} <td class="candidate{% if candidate.1 %} elected{% endif %}">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br> {% if candidate in assignment.elected.all %}
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br> <a class="elected">
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br> <img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
{% else %} </a>
{% if v != "-" %} {% endif %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ candidate }}
{% endif %} </td>
{{ v.0 }} {% for vote in votes %}
{# Hier stimmt es noch nicht. Es muss rein, dass nur veröffentlichte Wahlergebnisse angezeigt werden sollen #}
<td style="white-space:nowrap;"{% if candidate in assignment.elected.all %} class="elected"{% endif %}>
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
{% elif 'Votes' in vote %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
{% elif vote == None %}
{% trans 'was not a <br> candidate'%}
{% else %}
&nbsp;
{% endif %} {% endif %}
{% endif %}
</td> </td>
{% endfor %} {% endfor %}
{% endwith %} </tr>
</tr>
{% empty %}
<tr>
<td {% if assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
</tr>
{% endfor %}
<tr>
<td>{%trans 'Invalid votes' %}</td>
{% for p in polls %}
{% if p.published %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ p.print_votesinvalid }}</td>
{% endif %}
{% endfor %} {% endfor %}
</tr>
<tr class="total"> <tr>
<td><b>{%trans 'Votes cast' %}</b></td> <td>{%trans 'Invalid votes' %}</td>
{% for p in polls %} {% for poll in polls %}
{% if p.published %} {% if poll.published %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ p.print_votescast }}</b></td> <td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</tr> </tr>
</table>
{% endif %} <tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td>
{% for poll in polls %}
{% if poll.published %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ poll.print_votescast }}</b></td>
{% endif %}
{% endfor %}
</tr>
</table>
{% elif assignment.profile.exists %}
<i>{% trans "No ballots available." %}</i>
{% endif %}
<br> <br>
{% endblock %} {% endblock %}