Use label_tag to add punctuation

This commit is contained in:
Tom Hubrecht 2020-12-19 15:28:32 +01:00
parent d418fd9e3d
commit bc7967f01a
8 changed files with 67 additions and 68 deletions

View file

@ -3,31 +3,31 @@
<div class="field">
{% if field|is_checkbox %}
{% include "elections/forms/checkbox.html" with field=field %}
{% include "elections/forms/checkbox.html" with field=field %}
{% elif field|is_radio %}
{% include "elections/forms/radio.html" with field=field %}
{% include "elections/forms/radio.html" with field=field %}
{% elif field|is_input %}
{% include "elections/forms/input.html" with field=field %}
{% include "elections/forms/input.html" with field=field %}
{% elif field|is_textarea %}
{% include "elections/forms/textarea.html" with field=field %}
{% include "elections/forms/textarea.html" with field=field %}
{% elif field|is_select %}
{% include "elections/forms/select.html" with field=field %}
{% include "elections/forms/select.html" with field=field %}
{% elif field|is_file %}
{% include "elections/forms/file.html" with field=field %}
{% include "elections/forms/file.html" with field=field %}
{% else %}
{% include "elections/forms/other.html" with field=field %}
{% include "elections/forms/other.html" with field=field %}
{% endif %}
</div>
</div>

View file

@ -1,5 +1,4 @@
{% load bulma_utils %}
{% load i18n %}
{% load bulma_utils i18n %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }}
@ -20,12 +19,12 @@
</label>
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>

View file

@ -1,22 +1,22 @@
{% if errors %}
{% if form.non_field_errors %}
<div class="message is-danger">
<div class="message-header">
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
{% for non_field_error in form.non_field_errors %}
{{ non_field_error }}
{% endfor %}
</div>
</div>
{% endif %}
{% if form.non_field_errors %}
<div class="message is-danger">
<div class="message-header">
<button class="delete" aria-label="delete"></button>
</div>
<div class="message-body">
{% for non_field_error in form.non_field_errors %}
{{ non_field_error }}
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
{% for field in form.hidden_fields %}
{{ field }}
{{ field }}
{% endfor %}
{% for field in form.visible_fields %}
{% include 'elections/forms/field.html' %}
{% include 'elections/forms/field.html' %}
{% endfor %}

View file

@ -1,19 +1,19 @@
{% load bulma_utils %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }}
{{ field.label_tag }}
</label>
<div class="control">
{{ field|bulmafy:'input' }}
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>

View file

@ -1,19 +1,19 @@
{% if field.auto_id %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">
{{ field.label }}
</label>
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">
{{ field.label }}
</label>
{% endif %}
<div class="control {% if field|is_multiple_checkbox %}multiple-checkbox{% endif %}">
{{ field }}
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>

View file

@ -1,24 +1,24 @@
{% if field.auto_id %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }}
</label>
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label_tag }}
</label>
{% endif %}
<div class="control">
{% for choice in field %}
<label class="radio">
{{ choice.tag }}
{{ choice.choice_label }}
</label>
<label class="radio">
{{ choice.tag }}
{{ choice.choice_label }}
</label>
{% endfor %}
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>

View file

@ -1,7 +1,7 @@
{% load bulma_utils %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }}
{{ field.label_tag }}
</label>
<div class="control">
@ -10,12 +10,12 @@
</span>
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>

View file

@ -1,19 +1,19 @@
{% load bulma_utils %}
<label class="label {% if field.field.required %}{{ form.required_css_class }}{% endif %}">
{{ field.label }}
{{ field.label_tag }}
</label>
<div class="control">
{{ field|bulmafy:'textarea' }}
{% for error in field.errors %}
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
<span class="help is-danger {{ form.error_css_class }}">{{ error }}</span>
{% endfor %}
{% if field.help_text %}
<p class="help">
{{ field.help_text|safe }}
</p>
<p class="help">
{{ field.help_text|safe }}
</p>
{% endif %}
</div>
</div>