Fixed candidates order in beamer view. Some style changes.

This commit is contained in:
Emanuel Schuetze 2011-09-05 20:47:55 +02:00
parent fec269e4a7
commit 0b17ab10fe
4 changed files with 30 additions and 22 deletions

View File

@ -5,6 +5,7 @@
{% load tags %} {% load tags %}
<head> <head>
<link type="text/css" rel="stylesheet" href="/static/styles/beamer.css"> <link type="text/css" rel="stylesheet" href="/static/styles/beamer.css">
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" />
<script type="text/javascript" src="/static/javascript/jquery.js"></script> <script type="text/javascript" src="/static/javascript/jquery.js"></script>
<script type="text/javascript" src="/static/javascript/beamer.js"></script> <script type="text/javascript" src="/static/javascript/beamer.js"></script>
<title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title> <title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title>

View File

@ -44,13 +44,24 @@
</tr> </tr>
{% for vote in votes %} {% for vote in votes %}
<tr class="{% cycle 'odd' '' %}"> <tr class="{% cycle 'odd' '' %}">
{% for v in vote %} <td class="candidate">
<td>{% if v %} {% with vote|first as candidate %}
{{ candidate.0 }}
{% if candidate.1 %}
{% trans 'not elected' %}
{% else %}
{% trans 'elected' %}
{% endif %}
{% endwith %}
</td>
{% for v in vote|last %}
<td style="white-space:nowrap;">{% if v %}
{% if v|length == 3 %} {% 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-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-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> <img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %} {% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png">{% endif %}
{{ v }} {{ v }}
{% endif %} {% endif %}
{% else %}&empty;{% endif %} {% else %}&empty;{% endif %}

View File

@ -106,26 +106,21 @@ def beamer_edit(request, direction):
def assignment_votes(item): def assignment_votes(item):
votes = [] votes = []
if item.type == "ItemAssignment": if item.type == "ItemAssignment":
assignment = item.cast().assignment assignment = item.cast().assignment
# list of candidates # list of votes
candidates = set() votes = []
for option in Option.objects.filter(poll__assignment=assignment): for candidate in assignment.candidates:
candidates.add(option.value) tmplist = [[candidate, assignment.is_elected(candidate)], []]
# list of votes for poll in assignment.poll_set.all():
votes = [] if candidate in poll.options_values:
for candidate in candidates: option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
tmplist = [] if poll.optiondecision:
tmplist.append(candidate) tmplist[1].append([option.yes, option.no, option.undesided])
for poll in assignment.poll_set.all(): else:
if candidate in poll.options_values: tmplist[1].append(option.yes)
option = Option.objects.filter(poll=poll).filter(user=candidate)[0] else:
if poll.optiondecision: tmplist[1].append("-")
tmplist.append([option.yes, option.no, option.undesided]) votes.append(tmplist)
else:
tmplist.append(option.yes)
else:
tmplist.append("-")
votes.append(tmplist)
return votes return votes

View File

@ -160,6 +160,7 @@
<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-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> <img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %} {% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png">{% endif %}
{{ v }} {{ v }}
{% endif %} {% endif %}
{% else %}&empty;{% endif %} {% else %}&empty;{% endif %}