Affiche la liste des votant·e·s
This commit is contained in:
parent
097157d480
commit
dcbfbfd77b
3 changed files with 102 additions and 12 deletions
|
@ -5,7 +5,7 @@
|
|||
{% block content %}
|
||||
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-left is-flex-shrink-1">
|
||||
{# Titre de l'élection #}
|
||||
<div class="level-item">
|
||||
<h1 class="title">{{ election.name }}</h1>
|
||||
|
@ -21,20 +21,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% if election.start_date < current_time %}
|
||||
<div class="level-right">
|
||||
{# Confirmation de vote #}
|
||||
{% if has_voted %}
|
||||
<div class="level-right is-flex-shrink-1 is-flex-grow-1">
|
||||
{# Liste des votant·e·s #}
|
||||
<div class="level-item">
|
||||
<div class="tag is-medium is-outlined is-success is-light">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
<a class="button is-primary is-light is-outlined" href="{% url 'election.voters' election.pk %}">
|
||||
<span class="icon is-small">
|
||||
<i class="fas fa-list"></i>
|
||||
</span>
|
||||
<span>{% trans "Votre vote a bien été enregistré." %}</span>
|
||||
</div>
|
||||
<span>{% trans "Votant·e·s" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if election.start_date < current_time %}
|
||||
{# Statut de l'élection #}
|
||||
<div class="level-item">
|
||||
<span class="tag is-medium is-outlined is-light is-primary">
|
||||
|
@ -45,11 +43,21 @@
|
|||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
{# Confirmation de vote #}
|
||||
{% if has_voted %}
|
||||
<div class="block tag is-medium is-outlined is-success is-light">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Votre vote a bien été enregistré." %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Indications de connexion #}
|
||||
{% if election.start_date < current_time and election.end_date > current_time %}
|
||||
{% if can_vote %}
|
||||
|
|
|
@ -4,5 +4,82 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<div class="level">
|
||||
<div class="level-left">
|
||||
{# Titre de l'élection #}
|
||||
<div class="level-item">
|
||||
<h1 class="title">{{ election.name }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="level-item">
|
||||
<h3 class="subtitle">{% trans "Liste des votant·e·s" %}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<a class="button is-primary" href="{% url 'election.view' election.pk %}">
|
||||
<span class="icon is-small">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="message is-warning">
|
||||
<div class="message-body">
|
||||
{% if election.restricted %}
|
||||
{% trans "Seules les personnes présentes sur cette liste peuvent voter, vous avez dû recevoir un mail avec vos identifiants de connexion." %}
|
||||
{% else %}
|
||||
{% trans "Toute personne avec un compte CAS peut voter." %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-two-thirds">
|
||||
<table class="table is-striped is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Nom" %}</th>
|
||||
<th>{% trans "Vote enregistré" %}</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% with voters=election.voters.all %}
|
||||
{% if election.restricted %}
|
||||
{% for v in election.registered_voters.all %}
|
||||
<tr>
|
||||
<td>{{ v.full_name }}</td>
|
||||
<td>
|
||||
<span class="icon">
|
||||
{% if v in voters %}
|
||||
<i class="fas fa-check"></i>
|
||||
{% else %}
|
||||
<i class="fas fa-times"></i>
|
||||
{% endif %}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for v in voters %}
|
||||
<tr>
|
||||
<td>{{ v.full_name }}</td>
|
||||
<td>
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -61,5 +61,10 @@ urlpatterns = [
|
|||
),
|
||||
# Common views
|
||||
path("view/<int:pk>", views.ElectionView.as_view(), name="election.view"),
|
||||
path(
|
||||
"view/<int:pk>/voters",
|
||||
views.ElectionVotersView.as_view(),
|
||||
name="election.voters",
|
||||
),
|
||||
path("vote/<int:pk>", views.VoteView.as_view(), name="election.vote"),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue