mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Full CRUD for elections
This commit is contained in:
15
election/templates/election/create_template.jinja
Normal file
15
election/templates/election/create_template.jinja
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Create{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans %}Create{% endtrans %}
|
||||
<section class="election__add-candidature">
|
||||
<form action="" method="post">{{form.as_p()}}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
</section>
|
||||
{% endblock content %}
|
12
election/templates/election/delete_template.jinja
Normal file
12
election/templates/election/delete_template.jinja
Normal file
@ -0,0 +1,12 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Delete{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
<p>{% trans %}Are you sure you want to delete {% endtrans %}"{{ object }}"?</p>
|
||||
<input type="submit" value="Confirm" />
|
||||
</form>
|
||||
{% endblock content %}
|
@ -273,6 +273,10 @@ th {
|
||||
<tr class="role__title">
|
||||
<td colspan="{{election_lists.count() + 1}}">
|
||||
<span>{{role.title}}</span>
|
||||
{% if user.can_edit(role) and election.is_vote_editable -%}
|
||||
<a href="{{url('election:update_role', role_id=role.id)}}">{% trans %}Edit{% endtrans %}</a>
|
||||
<a href="{{url('election:delete_role', role_id=role.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
{%- endif -%}
|
||||
{%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %}
|
||||
<strong class="role__multiple-choices-label">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong>
|
||||
{%- endif %}
|
||||
@ -313,6 +317,14 @@ th {
|
||||
<figcaption class="candidate__details">
|
||||
<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>
|
||||
{%- if user.can_edit(candidature) -%}
|
||||
{% if election.is_vote_editable %}
|
||||
<a href="{{url('election:update_candidate', candidature_id=candidature.id)}}">{% trans %}Edit{% endtrans %}</a>
|
||||
{% endif %}
|
||||
{% if election.can_candidate -%}
|
||||
<a href="{{url('election:delete_candidate', candidature_id=candidature.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{%- if election.can_vote(user) %}
|
||||
|
15
election/templates/election/update_template.jinja
Normal file
15
election/templates/election/update_template.jinja
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Edit{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans %}Edit{% endtrans %}
|
||||
<section class="election__add-candidature">
|
||||
<form action="" method="post">{{form.as_p()}}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
</section>
|
||||
{% endblock content %}
|
Reference in New Issue
Block a user