Full CRUD for elections

This commit is contained in:
2016-12-24 18:29:26 +01:00
parent 4f62863599
commit c07f49305b
7 changed files with 185 additions and 6 deletions

View 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 %}

View 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 %}

View File

@ -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) %}

View 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 %}