OpenSlides/openslides/assignment/templates/assignment/view.html

210 lines
8.0 KiB
HTML
Raw Normal View History

2011-07-31 10:46:29 +02:00
{% extends "assignment/base_assignment.html" %}
{% block title %}{{ block.super }} - {% trans "Assignment" %} "{{ assignment }}"{% endblock %}
{% block content %}
<div id="sidebar">
<div class="box">
<h4>{% trans "Status" %}:</h4>
{% trans assignment.get_status_display %}
<h4>{% trans "Number of available posts" %}:</h4>
{{ 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-07-31 10:46:29 +02:00
<h4></h4>
<a href="{% url assignment_edit assignment.id %}">
<button><span class="icon edit">{%trans 'Edit' %}</span></button>
</a>
2011-07-31 10:46:29 +02:00
{% if not assignment.itemassignment_set.all %}
<h4></h4>
<a href='{% url item_new_default 'ItemAssignment' assignment.id %}'>
<button type="button">
<span class="icon item">{%trans 'New agenda item' %}</span>
</button>
</a>
{% endif %}
</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 %}'>
<button type="button">
<span class="icon removeuser">{%trans 'Withdraw self candidature' %}</span>
</button>
</a>
{% else %}
{% if user.profile %}
<a href='{% url assignment_run assignment.id %}'>
<button type="button">
<span class="icon adduser">{%trans 'Self candidature' %}</span>
</button>
</a>
{% endif %}
{% endif %}
</p>
{% endif %}
{% if perms.assignment.can_nominate_other %}
{% for field in form %}
<label>{{ field.label }}:</label>
<nobr>{{ field }}
{% if perms.participant.can_view_participants and perms.participant.can_manage_participants %}
<a href="{% url user_new %}"><img src="/static/images/icons/list-add-user.png" title="{% trans 'Add new participant' %}"></a>
{% endif %}
</nobr>
{% endfor %}
<p>
<button type="submit">
<span class="icon ok">{%trans 'Apply' %}</span>
</button>
</p>
{% endif %}
</form>
{% endif %}
{% endif %}
<p><br></p>
<h3>{% trans "Election results" %}</h3>
{% if assignment.poll_set.all.count > 0 %}
<table id="election_table" style="width: auto;">
2011-07-31 10:46:29 +02:00
<tr>
<th></th>
{% with ballotnumber=assignment.poll_set.all.count %}
<th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
{% trans "ballot" %}</th>
{% endwith %}
</tr>
<tr>
<th>{% trans "Candidates" %}</th>
{% for poll in assignment.poll_set.all %}
<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 }}.
2011-07-31 10:46:29 +02:00
{% if perms.assignment.can_manage_assignment %}
</a>
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
{% endif %}
</th>
{% 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 %}'>
2011-07-31 10:46:29 +02:00
<button type="button">
<span class="icon poll">{%trans 'New ballot' %}</span>
</button>
</a>
</th>
{% endif %}
</tr>
{% for vote in votes %}
<tr class="{% cycle 'odd' '' %}">
<td class="candidate">
{% with vote|first as candidate %}
{{ candidate.0 }}
{% if candidate.1 %}
<a class="election_link iselected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'>{% trans 'not elected' %}</a>
{% else %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'>{% trans 'elected' %}</a>
{% endif %}
{% endwith %}
</td>
{% for v in vote|last %}
2011-07-31 10:46:29 +02:00
<td style="white-space:nowrap;">{% 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 %}
{{ v }}
{% endif %}
{% else %}&empty;{% endif %}
</td>
{% endfor %}
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
{% endfor %}
<tr>
<td>{%trans 'Invalid votes' %}</td>
{% for p in polls %}
<td><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
{% endfor %}
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
<tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td>
{% for p in polls %}
<td><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
{% endfor %}
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
2011-07-31 10:46:29 +02:00
</table>
{% else %}
<i>{% trans "No ballots available." %}</i>
2011-07-31 10:46:29 +02:00
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<p><a href='{% url assignment_gen_poll assignment.id %}'>
2011-07-31 10:46:29 +02:00
<button type="button">
<span class="icon poll">{%trans 'New ballot' %}</span>
</button>
</a></p>
{% endif %}
{% endif %}
</div>
{% endblock %}