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 %}
<span class="indentation">&nbsp;</span>
{% 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 %}
<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 %}

View File

@ -204,11 +204,13 @@
{% endif %}
</h1>
{% trans "Version" %} {{ version.aid }}
{% if application.public_version != application.last_version %}
&#8901;
{% 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 %}
(<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 %}

View File

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

View File

@ -99,6 +99,7 @@
{% if polls %}
<table id="election_table" style="width: auto;">
<tr>
<th></th>
{% with ballotnumber=polls.count %}
@ -107,24 +108,25 @@
</th>
{% endwith %}
</tr>
<tr>
<th>{% trans "Candidates" %}</th>
{% 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;">
{{ forloop.counter }}. {% trans 'ballot' %}
{% if perms.assignment.can_manage_assignment %}
<br>
<a class="publish_link {% if poll.published %}published{% endif %}"
href="{% url assignment_poll_publish_status poll.id %}"
title="{%trans 'Publish/unpublish results' %}">
<span></span>
</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>
<br>
<a class="publish_link {% if poll.published %}published{% endif %}"
href="{% url assignment_poll_publish_status poll.id %}"
title="{%trans 'Publish/unpublish results' %}">
<span></span>
</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>
{% endif %}
</th>
{# endif #}
{% endif %}
{% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<th>
@ -136,46 +138,51 @@
</th>
{% endif %}
</tr>
{% for candidate, votes in vote_results.items %}
<tr class="{% cycle 'odd' '' %}">
<td class="candidate">
{% if candidate in assignment.elected.all %}
{% if perms.assignment.can_manage_assignment %}
<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 %}
<tr class="{% cycle 'odd' '' %}">
<td class="candidate">
{% if candidate in assignment.elected.all %}
{% if perms.assignment.can_manage_assignment %}
<a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.id %}'></a>
{% else %}
{% if perms.assignment.can_manage_assignment %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.id %}'></a>
{% endif %}
<a class="elected"><img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{{ candidate }}
</td>
{% for vote in votes %}
{% else %}
{% if perms.assignment.can_manage_assignment %}
<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;">
{% if vote %}
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
<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' %}"> {% if vote.No %}{{ vote.No }}{% else %}&empty;{% endif %}<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 %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if vote.Votes %}{{ vote.Votes }}{% else %}&empty;{% endif %}
{% 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 %}
</td>
{% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
{% endfor %}
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
{% endfor %}
<tr>
<td>{%trans 'Invalid votes' %}</td>
{% 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>
{% endif %}
{% endfor %}
@ -183,10 +190,11 @@
<td></td>
{% endif %}
</tr>
<tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td>
<td><strong>{%trans 'Votes cast' %}</strong></td>
{% 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>
{% endif %}
{% endfor %}

View File

@ -27,88 +27,88 @@
{% block scrollcontent %}
{% if not assignment.profile.exists %}
<p>
<div class="text">{{ assignment.description|linebreaks }}</div>
</p>
<p>
<div class="text">{{ assignment.description|linebreaks }}</div>
</p>
{% endif %}
{% if assignment.profile.exists and assignment.status != "fin" %}
<h3>{% trans "Candidates" %}</h3>
<ol>
{% for profile in assignment.profile.all|dictsort:"user.first_name" %}
<li>{{ profile }} </li>
{% empty %}
<li style="list-style: none outside none;">
<i>{% trans "No candidates available." %}</i>
</li>
{% endfor %}
</ol>
<p><br></p>
<h3>{% trans "Candidates" %}</h3>
<ol>
{% for profile in assignment.profile.all|dictsort:"user.first_name" %}
<li>{{ profile }} </li>
{% empty %}
<li style="list-style: none outside none;">
<i>{% trans "No candidates available." %}</i>
</li>
{% endfor %}
</ol>
<p><br></p>
{% endif %}
{% if polls.exists %}
<h3>{% trans "Election results" %}</h3>
<table>
<tr>
<th>{% trans "Candidates" %}</th>
{% for poll in assignment.poll_set.all %}
{% if poll.published %}
<th><nobr>{{forloop.counter}}. {% trans "ballot" %}</nobr></th>
{% endif %}
{% 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>
<h3>{% trans "Election results" %}</h3>
<table>
<tr>
<th>{% trans "Candidates" %}</th>
{% for poll in assignment.poll_set.all %}
{% if poll.published %}
<th><nobr>{{forloop.counter}}. {% trans "ballot" %}</nobr></th>
{% endif %}
{{ candidate.0 }}
</td>
{% for v in vote|last %}
<td style="white-space:nowrap;" {% if candidate.1 %}class="elected"{% endif %}>
{% if v %}
{% if v|length == 3 %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %}
{% if v != "-" %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}">
{% endif %}
{{ v.0 }}
{% endfor %}
</tr>
{% for candidate, votes in vote_results.items %}
<tr class="{% cycle 'odd' '' %}">
<td class="candidate{% if candidate.1 %} elected{% endif %}">
{% if candidate in assignment.elected.all %}
<a class="elected">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
</a>
{% endif %}
{{ candidate }}
</td>
{% 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 %}
</td>
{% endfor %}
{% endwith %}
</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 %}
</tr>
{% endfor %}
</tr>
<tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td>
{% for p in polls %}
{% if p.published %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ p.print_votescast }}</b></td>
{% endif %}
{% endfor %}
</tr>
</table>
{% endif %}
<tr>
<td>{%trans 'Invalid votes' %}</td>
{% for poll in polls %}
{% if poll.published %}
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
{% endif %}
{% endfor %}
</tr>
<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>
{% endblock %}