2011-07-31 10:46:29 +02:00
|
|
|
{% extends "assignment/base_assignment.html" %}
|
2012-02-09 16:57:10 +01:00
|
|
|
|
|
|
|
{% load i18n %}
|
|
|
|
|
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
{% block title %}{{ block.super }} - {% trans "Assignment" %} "{{ assignment }}"{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div id="sidebar">
|
|
|
|
|
|
|
|
<div class="box">
|
2011-09-07 22:03:04 +02:00
|
|
|
<h4 style="float:left;">{% trans "Status" %}:</h4>
|
2011-09-07 07:52:44 +02:00
|
|
|
<h4 style="text-align: right;">
|
|
|
|
<a href="{% url print_assignment assignment.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Election' %}"></a>
|
|
|
|
</h4>
|
|
|
|
<span clear="all"></span>
|
2011-07-31 10:46:29 +02:00
|
|
|
{% trans assignment.get_status_display %}
|
|
|
|
<h4>{% trans "Number of available posts" %}:</h4>
|
2011-09-03 10:52:29 +02:00
|
|
|
{{ assignment.posts }}
|
2011-07-31 10:46:29 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
{% if perms.assignment.can_manage_assignment %}
|
|
|
|
<div class="box">
|
|
|
|
<h4><b>{% trans "Manage election" %}</b></h4>
|
|
|
|
|
|
|
|
<h4>{% trans "Change status" %}:</h4>
|
|
|
|
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'sea' %}';"
|
|
|
|
{% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}<br>
|
|
|
|
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'vot' %}';"
|
|
|
|
{% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br>
|
|
|
|
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'fin' %}';"
|
|
|
|
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finish' %}
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
<h4></h4>
|
|
|
|
<a href="{% url assignment_edit assignment.id %}">
|
2011-11-14 19:33:45 +01:00
|
|
|
<span class="button">
|
|
|
|
<span class="icon edit">{%trans 'Edit' %}</span>
|
|
|
|
</span>
|
2011-07-31 10:46:29 +02:00
|
|
|
</a>
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2012-02-03 23:12:28 +01:00
|
|
|
|
2011-11-01 14:45:24 +01:00
|
|
|
<h4></h4>
|
|
|
|
<a href='{% url assignment_activate_item assignment.id %}'>
|
2011-11-14 19:33:45 +01:00
|
|
|
<span class="button">
|
2012-02-03 23:12:28 +01:00
|
|
|
<span class="icon projector">{%trans 'Beam assignment' %}</span>
|
2011-11-14 19:33:45 +01:00
|
|
|
</span>
|
2011-11-01 14:45:24 +01:00
|
|
|
</a>
|
2012-02-03 23:12:28 +01:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="margin-right: 250px; min-width: 400px;">
|
|
|
|
<h1>{{ assignment }}</h1>
|
|
|
|
<p>{{ assignment.description }}</p>
|
|
|
|
|
|
|
|
<h3>{% trans "Candidates" %}</h3>
|
|
|
|
<ol>
|
|
|
|
{% for profile in assignment.profile.all|dictsort:"user.first_name" %}
|
|
|
|
<li>{{ profile }}
|
|
|
|
{% if perms.assignment.can_manage_assignment %}
|
|
|
|
{% if assignment.status == "sea" or assignment.status == "vot" %}
|
|
|
|
<a href="{% url assignment_delother assignment.id profile.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Remove candidate' %}"></a>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% empty %}
|
|
|
|
<li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li>
|
|
|
|
{% endfor %}
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
{% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
|
|
|
{% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
|
|
|
|
<form action="" method="post">{% csrf_token %}
|
|
|
|
{% if perms.assignment.can_nominate_self %}
|
|
|
|
<p>
|
|
|
|
{% if user.profile in assignment.profile.all %}
|
|
|
|
|
|
|
|
<a href='{% url assignment_delrun assignment.id %}'>
|
2011-11-14 19:33:45 +01:00
|
|
|
<span class="button">
|
2011-07-31 10:46:29 +02:00
|
|
|
<span class="icon removeuser">{%trans 'Withdraw self candidature' %}</span>
|
2011-11-14 19:33:45 +01:00
|
|
|
</span>
|
2011-07-31 10:46:29 +02:00
|
|
|
</a>
|
|
|
|
{% else %}
|
|
|
|
{% if user.profile %}
|
|
|
|
<a href='{% url assignment_run assignment.id %}'>
|
2011-11-14 19:33:45 +01:00
|
|
|
<span class="button">
|
2011-07-31 10:46:29 +02:00
|
|
|
<span class="icon adduser">{%trans 'Self candidature' %}</span>
|
2011-11-14 19:33:45 +01:00
|
|
|
</span>
|
2011-07-31 10:46:29 +02:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</p>
|
|
|
|
{% endif %}
|
|
|
|
{% if perms.assignment.can_nominate_other %}
|
|
|
|
{% for field in form %}
|
|
|
|
<label>{{ field.label }}:</label>
|
|
|
|
<nobr>{{ field }}
|
2011-09-04 12:21:58 +02:00
|
|
|
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
|
2011-09-29 22:36:21 +02:00
|
|
|
<a href="{% url user_new %}" target="_blank"><img src="/static/images/icons/list-add-user.png" title="{% trans 'Add new participant' %}"></a>
|
2011-07-31 10:46:29 +02:00
|
|
|
{% endif %}
|
|
|
|
</nobr>
|
|
|
|
{% endfor %}
|
|
|
|
<p>
|
2011-11-14 19:33:45 +01:00
|
|
|
<button class="button" type="submit">
|
2011-07-31 10:46:29 +02:00
|
|
|
<span class="icon ok">{%trans 'Apply' %}</span>
|
|
|
|
</button>
|
|
|
|
</p>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<p><br></p>
|
|
|
|
<h3>{% trans "Election results" %}</h3>
|
|
|
|
|
2012-02-19 19:27:00 +01:00
|
|
|
{% if polls %}
|
2011-09-03 11:42:44 +02:00
|
|
|
<table id="election_table" style="width: auto;">
|
2011-07-31 10:46:29 +02:00
|
|
|
<tr>
|
2012-02-19 19:27:00 +01:00
|
|
|
<th></th>
|
|
|
|
{% with ballotnumber=polls.count %}
|
|
|
|
<th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
|
|
|
|
{% trans "ballot" %}</th>
|
|
|
|
{% endwith %}
|
2011-07-31 10:46:29 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-02-19 19:27:00 +01:00
|
|
|
<th>{% trans "Candidates" %}</th>
|
|
|
|
{% for poll in polls %}
|
|
|
|
{# if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment #}
|
|
|
|
<th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
|
|
|
|
{{ forloop.counter }}. {% trans 'ballot' %}
|
|
|
|
{% if perms.assignment.can_manage_assignment %}
|
|
|
|
</a>
|
|
|
|
{% if poll.published %}
|
|
|
|
<a href={% url assignment_poll_notpublish poll.id %}><img
|
|
|
|
src="/static/images/icons/user-online.png"
|
|
|
|
title="{% trans 'Unpublish results' %}"></a>
|
|
|
|
{% else %}
|
|
|
|
<a href={% url assignment_poll_publish poll.id %}><img
|
|
|
|
src="/static/images/icons/user-offline.png"
|
|
|
|
title="{% trans 'Publish results' %}"></a>
|
|
|
|
{% endif %}
|
|
|
|
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
|
|
|
|
{% endif %}
|
|
|
|
</th>
|
|
|
|
{# endif #}
|
|
|
|
{% endfor %}
|
|
|
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
|
|
|
<th>
|
|
|
|
<a href='{% url assignment_gen_poll assignment.id %}'>
|
|
|
|
<span class="button">
|
|
|
|
<span class="icon poll">{%trans 'New ballot' %}</span>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</th>
|
2011-07-31 10:46:29 +02:00
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
{% for vote in votes %}
|
|
|
|
<tr class="{% cycle 'odd' '' %}">
|
2011-09-03 11:42:44 +02:00
|
|
|
<td class="candidate">
|
|
|
|
{% with vote|first as candidate %}
|
|
|
|
{% if candidate.1 %}
|
2011-09-05 23:13:18 +02:00
|
|
|
{% if perms.assignment.can_manage_assignment %}
|
2012-02-19 19:27:00 +01:00
|
|
|
<a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'></a>
|
2011-09-05 23:13:18 +02:00
|
|
|
{% else %}
|
2012-02-19 19:27:00 +01:00
|
|
|
<a class="elected"><img src="/static/images/icons/games-highscores.png" title="{% trans 'Candidate is elected' %}"></a>
|
2011-09-05 23:13:18 +02:00
|
|
|
{% endif %}
|
2011-09-03 11:42:44 +02:00
|
|
|
{% else %}
|
2011-09-05 23:13:18 +02:00
|
|
|
{% if perms.assignment.can_manage_assignment %}
|
2012-02-19 19:27:00 +01:00
|
|
|
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'></a>
|
2011-09-05 23:13:18 +02:00
|
|
|
{% endif %}
|
2011-09-03 11:42:44 +02:00
|
|
|
{% endif %}
|
2011-09-05 23:13:18 +02:00
|
|
|
{{ candidate.0 }}
|
2011-09-03 11:42:44 +02:00
|
|
|
{% endwith %}
|
|
|
|
</td>
|
|
|
|
{% for v in vote|last %}
|
2012-02-19 19:27:00 +01:00
|
|
|
<td style="white-space:nowrap;">
|
|
|
|
{% if v %}
|
2011-07-31 10:46:29 +02:00
|
|
|
{% if v|length == 3 %}
|
|
|
|
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}∅{% endif %}<br>
|
|
|
|
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}∅{% endif %}<br>
|
|
|
|
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}∅{% endif %}<br>
|
|
|
|
{% else %}
|
2011-09-06 07:33:13 +02:00
|
|
|
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}">{% endif %}
|
2011-07-31 10:46:29 +02:00
|
|
|
{{ v }}
|
|
|
|
{% endif %}
|
2012-02-19 19:27:00 +01:00
|
|
|
{% else %}
|
|
|
|
∅
|
|
|
|
{% endif %}
|
2011-07-31 10:46:29 +02:00
|
|
|
</td>
|
|
|
|
{% endfor %}
|
2011-09-09 22:23:42 +02:00
|
|
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
2011-07-31 10:46:29 +02:00
|
|
|
<td></td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
2011-09-03 13:53:37 +02:00
|
|
|
<tr>
|
|
|
|
<td>{%trans 'Invalid votes' %}</td>
|
2012-02-19 19:27:00 +01:00
|
|
|
{% for poll in polls %}
|
|
|
|
{% if poll.published and not perms.assignment.can_manage_assignment 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>
|
2011-09-09 16:34:01 +02:00
|
|
|
{% endif %}
|
2011-09-03 13:53:37 +02:00
|
|
|
{% endfor %}
|
2011-09-09 22:23:42 +02:00
|
|
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
2011-09-03 13:53:37 +02:00
|
|
|
<td></td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
<tr class="total">
|
|
|
|
<td><b>{%trans 'Votes cast' %}</b></td>
|
2012-02-19 19:27:00 +01:00
|
|
|
{% for poll in polls %}
|
|
|
|
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
|
|
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ poll.print_votescast }}</b></td>
|
2011-09-09 16:34:01 +02:00
|
|
|
{% endif %}
|
2011-09-03 13:53:37 +02:00
|
|
|
{% endfor %}
|
2011-09-09 22:23:42 +02:00
|
|
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
2011-09-03 13:53:37 +02:00
|
|
|
<td></td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
2011-07-31 10:46:29 +02:00
|
|
|
</table>
|
|
|
|
|
|
|
|
{% else %}
|
|
|
|
|
|
|
|
<i>{% trans "No ballots available." %}</i>
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2011-07-31 10:46:29 +02:00
|
|
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
2011-09-03 10:52:29 +02:00
|
|
|
<p><a href='{% url assignment_gen_poll assignment.id %}'>
|
2011-11-14 19:33:45 +01:00
|
|
|
<span class="button">
|
2011-07-31 10:46:29 +02:00
|
|
|
<span class="icon poll">{%trans 'New ballot' %}</span>
|
2011-11-14 19:33:45 +01:00
|
|
|
</span>
|
2011-07-31 10:46:29 +02:00
|
|
|
</a></p>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% endblock %}
|