#109: New second submneu for election view.

This commit is contained in:
Emanuel Schuetze 2012-04-28 23:10:19 +02:00
parent 7eaf9899f6
commit dd10a59533
4 changed files with 49 additions and 24 deletions

View File

@ -19,4 +19,44 @@
{% endif %}
<li><a href="{% url print_assignment %}"><img src="{% static 'images/icons/pdf.png' %}"> {%trans 'All elections as PDF' %}</a></li>
</ul>
{# second submenu #}
{% if assignment %}
<br>
<h3>{{assignment}}</h3>
<ul>
{# view assignemnt #}
{% url assignment_view assignment.id as url_assignmentview %}
<li class="{% if request.path == url_assignmentview %}selected{% endif %}"><a href="{% url assignment_view assignment.id %}">{%trans 'View election' %}</a></li>
{% if perms.assignment.can_manage_assignment %}
{# edit assignemnt #}
{% url assignment_edit assignment.id as url_assignmentedit %}
<li class="{% if request.path == url_assignmentedit %}selected{% endif %}"><a href="{% url assignment_edit assignment.id %}">{%trans 'Edit election' %}</a></li>
{# delete assignment #}
<li><a href="{% url assignment_delete assignment.id %}"><img src="{% static 'images/icons/delete.png' %}"> {%trans 'Delete election' %}</a></li>
{% endif %}
{# PDF #}
<li><a href="{% url print_assignment assignment.id %}"><img src="{% static 'images/icons/pdf.png' %}"> {%trans 'Election as PDF' %}</a></li>
{# activate #}
{% if perms.projector.can_manage_projector %}
<li><a href="{% url projector_activate_slide assignment.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {%trans 'Show election' %}</a></li>
{% endif %}
{# polls #}
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<li><a href='{% url assignment_gen_poll assignment.id %}'><img src="{% static 'images/icons/statistics.png' %}"> {%trans 'New vote' %}</a></li>
{% endif %}
{% if perms.projector.can_manage_projector %}
{% for poll in polls %}
{% url assignment_poll_view poll.id as url_assignmentpollview %}
<li class="{% if request.path == url_assignmentpollview %}selected{% endif %}"><a href="{% url assignment_poll_view poll.id %}">{% trans "View Vote" %} {% if forloop.counter > 1 %}(#{{ forloop.counter }}){% endif %}</a></li>
{% url print_assignment_poll poll.id as url_assignmentedit %}
<li><a href="{% url print_assignment_poll poll.id %}"><img src="{% static 'images/icons/pdf.png' %}"> {%trans 'Ballot paper' %} {% if forloop.counter > 1 %}(#{{ forloop.counter }}){% endif %}</a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
{% endblock %}

View File

@ -9,11 +9,7 @@
<div id="sidebar">
<div class="box">
<h4 style="float:left;">{% trans "Status" %}:</h4>
<h4 style="text-align: right;">
<a href="{% url print_assignment assignment.id %}"><img src="{% static 'images/icons/pdf.png' %}" title="{% trans 'Election as PDF' %}"></a>
</h4>
<span clear="all"></span>
<h4>{% trans "Status" %}:</h4>
{% trans assignment.get_status_display %}
<h4>{% trans "Number of available posts" %}:</h4>
{{ assignment.posts }}
@ -23,8 +19,6 @@
{% 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>
@ -32,22 +26,6 @@
{% 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' %}
<h4></h4>
<a href="{% url assignment_edit assignment.id %}">
<span class="button">
<span class="icon edit">{%trans 'Edit' %}</span>
</span>
</a>
<h4></h4>
<a href='{% url assignment_activate_item assignment.id %}'>
<span class="button">
<span class="icon projector">{%trans 'Beam election' %}</span>
</span>
</a>
</div>
{% endif %}

View File

@ -130,9 +130,14 @@ def edit(request, assignment_id=None):
messages.error(request, _('Please check the form for errors.'))
else:
form = AssignmentForm(instance=assignment)
if assignment:
polls = assignment.poll_set.filter(assignment=assignment)
else:
polls = None
return {
'form': form,
'assignment': assignment,
'polls': polls,
}
@ -220,6 +225,7 @@ class ViewPoll(PollFormView):
self.assignment = self.poll.get_assignment()
context['assignment'] = self.assignment
context['poll'] = self.poll
context['polls'] = self.assignment.poll_set.filter(assignment=self.assignment)
#context['ballotnumber'] = self.poll.get_ballot()
return context

View File

@ -133,11 +133,12 @@ body {
#submenu .section h3 {
border-bottom:1px dashed #B9A894;
color:#B9A894;
padding:15px 20px 10px 50px;
padding:15px 20px 10px 5px;
margin:0px;
margin-bottom:0px;
font-size: 16px;
text-align:right;
overflow:hidden;
}
#submenu li a {
color:#B9A894;