summaryrefslogtreecommitdiffstats
path: root/templates/w3/layout/checkboxselectmultiple.html
diff options
context:
space:
mode:
authorYulqen <246857+yulqen@users.noreply.github.com>2024-04-23 11:22:21 +0100
committerGitHub <noreply@github.com>2024-04-23 11:22:21 +0100
commitceca6fa956b21c43263e53c328d619c4ede21914 (patch)
treea48384210cdc168e3bd3ccff6d6d516eeed9e748 /templates/w3/layout/checkboxselectmultiple.html
parent8b084e9fe7a5f3a04c32daf9a24f7f2cf67300f9 (diff)
parent0f951dcf029d4af284467543a3afdf5bf6581a20 (diff)
Merge pull request #22 from defencedigital/pyswitch
switched to Django
Diffstat (limited to 'templates/w3/layout/checkboxselectmultiple.html')
-rw-r--r--templates/w3/layout/checkboxselectmultiple.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/templates/w3/layout/checkboxselectmultiple.html b/templates/w3/layout/checkboxselectmultiple.html
new file mode 100644
index 0000000..c943fc4
--- /dev/null
+++ b/templates/w3/layout/checkboxselectmultiple.html
@@ -0,0 +1,29 @@
+{% load crispy_forms_filters %}
+{% load l10n %}
+
+<div {% if field_class %}class="{{ field_class }}"{% endif %}{% if flat_attrs %} {{ flat_attrs }}{% endif %}>
+
+ {% for group, options, index in field|optgroups %}
+ {% if group %}<strong>{{ group }}</strong>{% endif %}
+ {% for option in options %}
+ <div class="{%if use_custom_control%}custom-control custom-checkbox{% if inline_class %} custom-control-inline{% endif %}{% else %}form-check{% if inline_class %} form-check-inline{% endif %}{% endif %}">
+ <input type="checkbox" class="{%if use_custom_control%}custom-control-input{% else %}form-check-input{% endif %}{% if field.errors %} is-invalid{% endif %}" name="{{ field.html_name }}" value="{{ option.value|unlocalize }}" {% include "w3/layout/attrs.html" with widget=option %}>
+ <label class="{%if use_custom_control%}custom-control-label{% else %}form-check-label{% endif %}" for="{{ option.attrs.id }}">
+ {{ option.label|unlocalize }}
+ </label>
+ {% if field.errors and forloop.last and not inline_class and forloop.parentloop.last %}
+ {% include 'w3/layout/field_errors_block.html' %}
+ {% endif %}
+ </div>
+ {% endfor %}
+ {% endfor %}
+ {% if field.errors and inline_class %}
+ <div class="w-100 {%if use_custom_control%}custom-control custom-checkbox{% if inline_class %} custom-control-inline{% endif %}{% else %}form-check{% if inline_class %} form-check-inline{% endif %}{% endif %}">
+ {# the following input is only meant to allow boostrap to render the error message as it has to be after an invalid input. As the input has no name, no data will be sent. #}
+ <input type="checkbox" class="custom-control-input {% if field.errors %}is-invalid{%endif%}">
+ {% include 'w3/layout/field_errors_block.html' %}
+ </div>
+ {% endif %}
+
+ {% include 'w3/layout/help_text.html' %}
+</div>