2016-12-05 22:49:13 +00:00
|
|
|
{% extends "core/base.jinja" %}
|
|
|
|
|
|
|
|
{% block title %}
|
2016-12-21 17:19:43 +00:00
|
|
|
{{object.title}}
|
2016-12-05 22:49:13 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2016-12-21 17:19:43 +00:00
|
|
|
{% block head %}
|
|
|
|
{{ super() -}}
|
|
|
|
<style type="text/css">
|
2016-12-21 20:17:31 +00:00
|
|
|
time {
|
2016-12-22 00:57:17 +00:00
|
|
|
font-weight: bolder;
|
2016-12-21 20:17:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
th {
|
2016-12-22 00:57:17 +00:00
|
|
|
padding: 5px;
|
|
|
|
margin: 5px;
|
|
|
|
border: solid 1px darkgrey;
|
|
|
|
border-collapse: collapse;
|
|
|
|
vertical-align: top;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.election__title {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin: 0;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.election__description {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin: 0;
|
|
|
|
margin-top: 5px;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.election__details {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin: 0;
|
|
|
|
margin-bottom: 5px;
|
2016-12-21 20:17:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.role {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-12-21 23:16:48 +00:00
|
|
|
.role .role__title {
|
2016-12-22 00:57:17 +00:00
|
|
|
background: lightgrey;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.role__multiple-choices {
|
2016-12-22 00:57:17 +00:00
|
|
|
color: darkgreen;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.role .role_candidates {
|
2016-12-22 00:57:17 +00:00
|
|
|
background: white;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
2016-12-21 20:17:31 +00:00
|
|
|
.list-per-role {
|
2016-12-22 00:57:17 +00:00
|
|
|
padding: 5px;
|
|
|
|
max-width: 310px;
|
2016-12-21 20:17:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-per-role__candidates {
|
2016-12-22 00:57:17 +00:00
|
|
|
list-style: none;
|
|
|
|
margin: 0;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.list-per-role__candidate:not(:last-child) {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin-bottom: 5px;
|
2016-12-21 20:17:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate {
|
2016-12-22 00:57:17 +00:00
|
|
|
display: flex;
|
|
|
|
flex-flow: row nowrap;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__picture-wrapper {
|
2016-12-22 00:57:17 +00:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2016-12-21 23:16:48 +00:00
|
|
|
|
2016-12-22 00:57:17 +00:00
|
|
|
width: 150px;
|
|
|
|
height: 150px;
|
2016-12-21 23:16:48 +00:00
|
|
|
|
2016-12-22 00:57:17 +00:00
|
|
|
background-color: lightgrey;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__picture {
|
2016-12-22 00:57:17 +00:00
|
|
|
max-width: 150px;
|
|
|
|
max-height: 150px;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__infos {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin-left: 5px;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__full-name {
|
2016-12-22 00:57:17 +00:00
|
|
|
display: block;
|
2016-12-21 23:16:48 +00:00
|
|
|
|
2016-12-22 00:57:17 +00:00
|
|
|
font-weight: bolder;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__nick-name {
|
2016-12-22 00:57:17 +00:00
|
|
|
font-style: italic;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__program {
|
2016-12-22 00:57:17 +00:00
|
|
|
display: block;
|
|
|
|
margin-top: 5px;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__vote-input {
|
2016-12-22 00:57:17 +00:00
|
|
|
position: absolute;
|
|
|
|
border: 0;
|
|
|
|
height: 1px;
|
|
|
|
width: 1px;
|
|
|
|
padding: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
clip: rect(0, 0, 0, 0);
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__vote-choice {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin-top: 5px;
|
|
|
|
padding: 15px;
|
2016-12-21 23:16:48 +00:00
|
|
|
|
2016-12-22 00:57:17 +00:00
|
|
|
border: solid 1px darkgrey;
|
2016-12-21 23:16:48 +00:00
|
|
|
|
2016-12-22 00:57:17 +00:00
|
|
|
text-align: center;
|
|
|
|
cursor: pointer;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__vote-choice:hover, .candidate__vote-choice:focus {
|
2016-12-22 00:57:17 +00:00
|
|
|
background: lightgrey;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
2016-12-21 20:17:31 +00:00
|
|
|
|
2016-12-21 23:16:48 +00:00
|
|
|
.candidate__vote-input:checked + .candidate__vote-choice {
|
2016-12-22 00:57:17 +00:00
|
|
|
border-width: 2px;
|
|
|
|
border-color: darkgreen;
|
|
|
|
color: darkgreen;
|
|
|
|
font-weight: bolder;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.candidate__vote-input:checked + .candidate__vote-choice:hover,
|
|
|
|
.candidate__vote-input:checked + .candidate__vote-choice:focus {
|
2016-12-22 00:57:17 +00:00
|
|
|
background: palegreen;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.election__sumbit-section {
|
2016-12-22 00:57:17 +00:00
|
|
|
margin-top: 5px;
|
2016-12-21 23:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.election__sumbit-button {
|
2016-12-22 00:57:17 +00:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
padding: 20px;
|
|
|
|
background: white;
|
|
|
|
border: solid 15px orange;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 200%;
|
|
|
|
font-weight: bolder;
|
|
|
|
cursor: pointer;
|
2016-12-21 20:17:31 +00:00
|
|
|
}
|
2016-12-21 17:19:43 +00:00
|
|
|
</style>
|
|
|
|
{%- endblock %}
|
|
|
|
|
2016-12-05 22:49:13 +00:00
|
|
|
{% block content %}
|
2016-12-22 00:57:17 +00:00
|
|
|
<h3 class="election__title">{{ object.title }}</h3>
|
|
|
|
<p class="election__description">{{ object.description }}</p>
|
|
|
|
<hr>
|
|
|
|
<section>
|
|
|
|
<p class="election__details">
|
|
|
|
{% trans %}Polls close {% endtrans %}
|
|
|
|
<time datetime="{{ election.end_date }}">{{ election.end_date|date("l d F Y") }}</time> at <time>{{ election.end_date|time("G:i") }}</time>
|
|
|
|
</p>
|
|
|
|
{# {%- if object.has_voted(request.user) %}
|
|
|
|
<p class="election__elector-infos">
|
|
|
|
<span>{% trans %}You already have submitted your vote.{% endtrans %}</span>
|
|
|
|
</p>
|
|
|
|
{%- endif %}
|
|
|
|
#} </section>
|
|
|
|
<section>
|
|
|
|
<table>
|
|
|
|
{%- set election_lists = object.election_list.all() -%}
|
|
|
|
<caption></caption>
|
|
|
|
<thead>
|
|
|
|
{%- for election_list in election_lists %}
|
|
|
|
<th>{{election_list.title}}</th>
|
|
|
|
{%- endfor %}
|
|
|
|
<th>{% trans %}Blank vote{% endtrans %}</th>
|
|
|
|
</thead>
|
|
|
|
{%- for role in object.role.all() %}
|
|
|
|
<tbody class="role">
|
|
|
|
<tr class="role__title">
|
|
|
|
<td colspan="{{election_lists.count() + 1}}">
|
|
|
|
<span>{{role.title}}</span>
|
|
|
|
{%- if role.max_choice > 1 %}
|
|
|
|
<strong class="role__multiple-choices">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong>
|
|
|
|
{%- endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="role_candidates">
|
|
|
|
{%- for election_list in election_lists %}
|
|
|
|
<td class="list-per-role">
|
|
|
|
<ul class="list-per-role__candidates">
|
|
|
|
{%- for candidature in election_list.candidature.filter(role=role) %}
|
|
|
|
<li class="list-per-role__candidate">
|
|
|
|
<figure class="candidate">
|
|
|
|
<div class="candidate__picture-wrapper">
|
|
|
|
{%- if candidature.user.profile_pict %}
|
|
|
|
<img class="candidate__picture" src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}">
|
|
|
|
{%- endif %}
|
|
|
|
</div>
|
|
|
|
<figcaption class="candidate__infos">
|
|
|
|
<cite class="candidate__full-name">{{ candidature.user.first_name }} <em class="candidate__nick-name">{{candidature.user.nick_name or ''}} </em>{{ candidature.user.last_name }}</cite>
|
|
|
|
<q class="candidate__program">{{ candidature.program or '' }}</q>
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
{%- if object.is_active %}
|
|
|
|
<input id="id" class="candidate__vote-input" type="radio" name="vote">
|
|
|
|
<label for="id" class="candidate__vote-choice">
|
|
|
|
<span>{% trans %}Choose{% endtrans %} {{ candidature.user.nick_name or candidature.user.first_name }}</span>
|
|
|
|
</label>
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{%- endfor %}
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
{%- endfor %}
|
|
|
|
<td class="list-per-role">
|
|
|
|
{%- if object.is_active %}
|
|
|
|
<input id="id" class="candidate__vote-input" type="radio" name="vote">
|
|
|
|
<label for="id" class="candidate__vote-choice">
|
|
|
|
<span>{% trans %}Choose blank vote{% endtrans %}</span>
|
|
|
|
</label>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
{%- endfor %}
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
<section class="election__sumbit-section">
|
|
|
|
<button class="election__sumbit-button">{% trans %}Submit the vote !{% endtrans %}</button>
|
|
|
|
</section>
|
|
|
|
<a href="{{url('election:create_list')}}">{% trans %}Add a new list{% endtrans %}</a>
|
|
|
|
<a href="{{url('election:create_role')}}">{% trans %}Add a new role{% endtrans %}</a>
|
|
|
|
<form action="{{url('election:candidate', election_id=object.id)}}" method="post">{{candidate_form}}
|
|
|
|
{% csrf_token %}
|
2016-12-22 00:28:51 +00:00
|
|
|
<p><input type="submit" value="{% trans %}Candidate{% endtrans %}" /></p>
|
2016-12-22 00:57:17 +00:00
|
|
|
</form>
|
|
|
|
<form action="{{url('election:vote', election_id=object.id)}}" method="post">
|
|
|
|
{{election_form.as_p()}}
|
2016-12-22 00:28:51 +00:00
|
|
|
<p><input type="submit" value="{% trans %}Vote{% endtrans %}" /></p>
|
2016-12-22 00:57:17 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
</form>
|
2016-12-05 22:49:13 +00:00
|
|
|
{% endblock %}
|