On utilise un template commun pour des formulaires
This commit is contained in:
parent
b9703e6e78
commit
50453a799a
8 changed files with 52 additions and 156 deletions
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n bulma_utils %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -7,34 +7,7 @@
|
|||
<h1 class="title">{% trans "Supprimer un vote" %}</h1>
|
||||
<hr>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-half">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Enregistrer" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{% url 'election.voters' election.pk %}#v_{{ anchor }}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% url 'election.voters' election.pk as r_url %}
|
||||
{% include "forms/common-form.html" with c_size="is-half" r_anchor="v_"|concatenate:anchor %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -31,16 +31,7 @@
|
|||
<h1 class="title">{% trans "Création d'une élection" %}</h1>
|
||||
<hr>
|
||||
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" with errors=False %}
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">{% trans "Enregistrer" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% url 'election.list' as r_url %}
|
||||
{% include "forms/common-form.html" with c_size="is-12" errors=False %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -31,33 +31,7 @@
|
|||
<h1 class="title">{% trans "Modification d'une élection" %}</h1>
|
||||
<hr>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-two-thirds">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" with errors=False %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Enregistrer" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{% url 'election.admin' election.pk %}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% url 'election.admin' election.pk as r_url %}
|
||||
{% include "forms/common-form.html" with errors=False %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -18,34 +18,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-two-thirds">
|
||||
<form action="" method="post" enctype="multipart/form-data" id="import-voters">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Envoyer" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{% url 'election.upload-voters' election.pk %}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% url 'election.upload-voters' election.pk as r_url %}
|
||||
{% trans "Envoyer" as f_submit %}
|
||||
{% include "forms/common-form.html" %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n static %}
|
||||
{% load i18n static bulma_utils %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -13,33 +13,7 @@
|
|||
<h1 class="title">{% trans "Modification d'une option" %}</h1>
|
||||
<hr>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-two-thirds">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" with errors=False %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Enregistrer" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{% url 'election.admin' option.question.election.pk %}#o_{{ option.pk }}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% url 'election.admin' option.question.election.pk as r_url %}
|
||||
{% include "forms/common-form.html" with anchor=o_|concatenate:option.pk %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n static %}
|
||||
{% load i18n static bulma_utils %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -13,33 +13,7 @@
|
|||
<h1 class="title">{% trans "Modification d'une question" %}</h1>
|
||||
<hr>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column is-two-thirds">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" with errors=False %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Enregistrer" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{% url 'election.admin' question.election.pk %}#q_{{ question.pk }}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% trans "Retour" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% url 'election.admin' question.election.pk as r_url %}
|
||||
{% include "forms/common-form.html" with errors=False r_anchor="q_"|concatenate:question.pk %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -72,3 +72,8 @@ def bulma_message_tag(tag):
|
|||
return "danger"
|
||||
|
||||
return tag
|
||||
|
||||
|
||||
@register.filter
|
||||
def concatenate(a, b):
|
||||
return str(a) + str(b)
|
||||
|
|
31
shared/templates/forms/common-form.html
Normal file
31
shared/templates/forms/common-form.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{% load i18n %}
|
||||
|
||||
<div class="columns is-centered">
|
||||
<div class="column {% if c_size %}{{ c_size }}{% else %}is-two-thirds{% endif %}">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "forms/form.html" %}
|
||||
|
||||
<div class="field is-grouped is-centered">
|
||||
<div class="control is-expanded">
|
||||
<button class="button is-fullwidth is-outlined is-primary is-light" type="submit">
|
||||
<span class="icon">
|
||||
<i class="fas fa-{% if f_icon %}{{ f_icon }}{% else %}check{% endif %}"></i>
|
||||
</span>
|
||||
<span>{% if f_submit %}{{ f_submit }}{% else %}{% trans "Enregister" %}{% endif %}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<a class="button is-primary" href="{{ r_url }}{% if r_anchor %}#{{ r_anchor }}{% endif %}">
|
||||
<span class="icon">
|
||||
<i class="fas fa-undo-alt"></i>
|
||||
</span>
|
||||
<span>{% if f_return %}{{ f_return }}{% else %}{% trans "Retour" %}{% endif %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue