Adjusted template for assignment app.

This commit is contained in:
Emanuel Schuetze 2012-09-06 23:58:20 +02:00
parent 7c90206b3f
commit ae51d9e7da
3 changed files with 209 additions and 192 deletions

View File

@ -1,4 +1,4 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
@ -11,27 +11,24 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>
{% if assignment %} {% if assignment %}
<h1>{% trans "Edit election" %}</h1> {% trans "Edit election" %}
{% else %} {% else %}
<h1>{% trans "New election" %}</h1> {% trans "New election" %}
{% endif %} {% endif %}
<small class="pull-right">
<a href="{% url assignment_overview %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_saveapply.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href='{% url assignment_overview %}' class="btn">
</button> {% trans 'Cancel' %}
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href='{% url assignment_overview %}'>
<button class="button" type="button" onclick="window.location='{% url assignment_overview %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>

View File

@ -1,30 +1,41 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Elections" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Elections" %}{% endblock %}
{% block content %}
<h1>{% trans "Elections" %}</h1>
<p><form action="{{request.url}}" name="filter" method="get"> {% block content %}
<h1>{% trans "Elections" %}
<small class="pull-right">
{% if perms.assignment.can_manage_assignment %}
<a href="{% url assignment_new %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New election' %}"><i class="icon-plus"></i> {% trans "New" %}</a>
{% endif %}
{% if perms.assignment.can_see_assignment %}
<a href="{% url print_assignment %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
</small>
</h1>
<form action="{{request.url}}" name="filter" method="get">
{% trans "Filter" %}: {% trans "Filter" %}:
<select class="default-input" name="status" onchange="document.forms['filter'].submit()"> <select class="span3" name="status" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Status" %}--</option> <option value="---">-- {% trans "Status" %}--</option>
<option value="sea" {% if 'sea' in request.GET.status %}selected{% endif %}>{% trans "Searching for candidates" %}</option> <option value="sea" {% if 'sea' in request.GET.status %}selected{% endif %}>{% trans "Searching for candidates" %}</option>
<option value="vot" {% if 'vot' in request.GET.status %}selected{% endif %}>{% trans "Voting" %}</option> <option value="vot" {% if 'vot' in request.GET.status %}selected{% endif %}>{% trans "Voting" %}</option>
<option value="fin" {% if 'fin' in request.GET.status %}selected{% endif %}>{% trans "Finished" %}</option> <option value="fin" {% if 'fin' in request.GET.status %}selected{% endif %}>{% trans "Finished" %}</option>
</select> </select>
</form> </form>
</p>
{{ assignments|length }} <small><i>{{ assignments|length }}
{% blocktrans count counter=assignments|length %}election{% plural %}elections{% endblocktrans %} {% blocktrans count counter=assignments|length %}election{% plural %}elections{% endblocktrans %}
</i></small>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<tr> <tr>
<th><a href="?sort=name{% if 'name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Election" %}</a></th> <th><a href="?sort=name{% if 'name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Election" %}</a></th>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th> <th class="optional"><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th>
<th style="width: 1px;">{% trans "Actions" %}</th> <th style="width: 1px;">{% trans "Actions" %}</th>
</tr> </tr>
{% for assignment in assignments %} {% for assignment in assignments %}
@ -32,7 +43,7 @@
{% if assignment.active %}activeline{% endif %}"> {% if assignment.active %}activeline{% endif %}">
<td><a href="{% url assignment_view assignment.id %}">{{ assignment }}</a></td> <td><a href="{% url assignment_view assignment.id %}">{{ assignment }}</a></td>
<td>{{ assignment.candidates|length }} / {{ assignment.posts }}</td> <td>{{ assignment.candidates|length }} / {{ assignment.posts }}</td>
<td>{{ assignment.get_status_display }}</td> <td class="optional">{{ assignment.get_status_display }}</td>
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}

View File

@ -1,70 +1,64 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %} {% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %}
{% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/assignment.css' %}" />
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{% static 'javascript/assignment.js' %}"></script>
{% endblock %}
{% block content %} {% block content %}
<div id="sidebar"> <h1>{{ assignment }}
<div class="box"> <small class="pull-right">
<h4>{% trans "Status" %}:</h4> <a href="{% url assignment_overview %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
{% trans assignment.get_status_display %} </small>
<h4>{% trans "Number of available posts" %}:</h4> </h1>
{{ assignment.posts }}
</div>
<br><br>
{% if perms.assignment.can_manage_assignment %} <div class="row-fluid">
<div class="box"> <div class="span9">
<h4>{% trans "Change status" %}:</h4> <!-- Description -->
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'sea' %}';" <h4>{% trans "Description" %}</h4>
{% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}<br> {% if assignment.description %}
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'vot' %}';" {{ assignment.description|linebreaks }}
{% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br> {% else %}
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'fin' %}';"
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finished' %}
</div>
{% endif %} {% endif %}
</div> <br>
<!-- Candidates -->
<div style="margin-right: 250px; min-width: 400px;"> <h4>{% trans "Candidates" %}</h4>
<h1>{{ assignment }}</h1>
<p>{{ assignment.description }}</p>
<h3>{% trans "Candidates" %}</h3>
<ol> <ol>
{% for person in assignment.candidates %} {% for person in assignment.candidates %}
<li> <li>
{{ person }} {{ person }}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %} {% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url assignment_delother assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a> <a href="{% url assignment_delother assignment.id person.person_id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"><i class="icon-remove"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</li> </li>
{% empty %} {% empty %}
<li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li> <li style="list-style: none outside none; margin-left: -25px;"><i>{% trans "No candidates available." %}</i></li>
{% endfor %} {% endfor %}
</ol> </ol>
{% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% 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 %} {% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% if perms.assignment.can_nominate_self %} {% if perms.assignment.can_nominate_self %}
<p> <p>
{% if user_is_candidate %} {% if user_is_candidate %}
<a href='{% url assignment_delrun assignment.id %}'> <a href='{% url assignment_delrun assignment.id %}' class="btn">
<span class="button"> <i class="icon-remove"></i> {% trans 'Withdraw self candidature' %}
<span class="icon removeuser">{% trans 'Withdraw self candidature' %}</span>
</span>
</a> </a>
{% else %} {% else %}
<a href='{% url assignment_run assignment.id %}'> <a href='{% url assignment_run assignment.id %}' class="btn">
<span class="button"> <i class="icon-plus"></i> {% trans 'Self candidature' %}
<span class="icon adduser">{% trans 'Self candidature' %}</span>
</span>
</a> </a>
{% endif %} {% endif %}
</p> </p>
@ -79,22 +73,18 @@
</nobr> </nobr>
{% endfor %} {% endfor %}
<p> <p>
<button class="button" type="submit"> <button class="btn" type="submit">
<span class="icon ok">{% trans 'Apply' %}</span> {% trans 'Apply' %}
</button> </button>
</p> </p>
{% endif %} {% endif %}
</form> </form>
{% endif %} {% endif %}
{% endif %} {% endif %}
<!-- Results -->
<p><br></p> <h4>{% trans "Election results" %}</h4>
<h3>{% trans "Election results" %}</h3> {% if polls.exists %}
<table class="table table-striped table-bordered">
{% if polls.exists %}
<table id="election_table" style="width: auto;">
<tr> <tr>
<th></th> <th></th>
{% with ballotnumber=polls.count %} {% with ballotnumber=polls.count %}
@ -103,11 +93,10 @@
</th> </th>
{% endwith %} {% endwith %}
</tr> </tr>
<tr> <tr>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
{% for poll in polls %} {% for poll in polls %}
<th style="vertical-align: top; white-space:nowrap;"> <th style="white-space:nowrap;" class="span1">
{{ poll.get_ballot }}. {% trans 'ballot' %} {{ poll.get_ballot }}. {% trans 'ballot' %}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
<br> <br>
@ -116,25 +105,22 @@
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 %}" class="btn btn-mini" title="{% trans 'Edit' %}"><i class="icon-pencil"></i></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 %}" class="btn btn-mini" title="{% trans 'Delete' %}"><i class="icon-remove"></i></a>
{% endif %} {% endif %}
</th> </th>
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<th> <th class="span1 nobr">
<a href='{% url assignment_gen_poll assignment.id %}'> <a href='{% url assignment_gen_poll assignment.id %}' class="btn">
<span class="button"> <i class="icon-plus"></i> {% trans 'New ballot' %}
<span class="icon statistics">{% trans 'New ballot' %}</span>
</span>
</a> </a>
</th> </th>
{% endif %} {% endif %}
</tr> </tr>
{% for candidate, poll_list in vote_results.items %} {% for candidate, poll_list in vote_results.items %}
<tr class="{% cycle 'odd' '' %}"> <tr>
<td class="candidate"> <td>
{% if candidate in assignment.elected %} {% if candidate in assignment.elected %}
{% 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.person_id %}'></a> <a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.person_id %}'></a>
@ -170,7 +156,6 @@
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
<td>{% trans 'Invalid votes' %}</td> <td>{% trans 'Invalid votes' %}</td>
{% for poll in polls %} {% for poll in polls %}
@ -188,7 +173,7 @@
{% endif %} {% endif %}
</tr> </tr>
<tr class="total"> <tr class="info total">
<td><strong>{% trans 'Votes cast' %}</strong></td> <td><strong>{% trans 'Votes cast' %}</strong></td>
{% for poll in polls %} {% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignment %} {% if poll.published or perms.assignment.can_manage_assignment %}
@ -205,21 +190,45 @@
{% endif %} {% endif %}
</tr> </tr>
</table> </table>
{% else %}
{% else %}
<i>{% trans "No ballots available." %}</i> <i>{% trans "No ballots available." %}</i>
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<p><a href='{% url assignment_gen_poll assignment.id %}'> <p>
<span class="button"> <a href='{% url assignment_gen_poll assignment.id %}' class="btn">
<span class="icon statistics">{% trans 'New ballot' %}</span> <i class="icon-plus"></i> {% trans 'New ballot' %}
</span> </a>
</a></p> </p>
{% endif %} {% endif %}
{% endif %}
</div> <!--/span-->
{% endif %} <div class="span3">
<div class="well">
</div> <!-- Text -->
<h5>{% trans "Status" %}:</h5>
{% trans assignment.get_status_display %}
<!-- Posts -->
<h5>{% trans "Number of available posts" %}:</h5>
{{ assignment.posts }}
</div> <!--/well-->
{% if perms.assignment.can_manage_assignment %}
<div class="well">
<h4>{% trans "Change status" %}:</h4>
<label class="radio">
<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' %}
</label>
<label class="radio">
<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>
</label>
<label class="radio">
<input type="radio" name="status" onclick="window.location.href='{% url assignment_set_status assignment.id 'fin' %}';"
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finished' %}
</label>
</div> <!--/well-->
{% endif %}
</div> <!--/span-->
</div> <!--/row-->
{% endblock %} {% endblock %}