2019-03-18 16:12:12 +00:00
|
|
|
{% from "components/select-input.html" import select_nested, select %}
|
2019-02-25 16:23:28 +00:00
|
|
|
|
2016-02-23 15:45:19 +00:00
|
|
|
{% macro checkbox(
|
|
|
|
|
field,
|
|
|
|
|
hint=False,
|
2019-03-18 16:12:12 +00:00
|
|
|
width='2-3'
|
2016-02-23 15:45:19 +00:00
|
|
|
) %}
|
2016-12-19 10:36:17 +00:00
|
|
|
<div class="multiple-choice">
|
2019-03-18 16:12:12 +00:00
|
|
|
{{ checkbox_input(field.id, field.name, field.data) }}
|
2016-12-19 10:36:17 +00:00
|
|
|
<label for="{{ field.id }}">
|
|
|
|
|
{{ field.label.text }}
|
|
|
|
|
{% if hint %}
|
|
|
|
|
<div class="hint">
|
|
|
|
|
{{ hint }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2016-02-23 15:45:19 +00:00
|
|
|
</label>
|
2016-12-19 10:36:17 +00:00
|
|
|
</div>
|
2017-02-13 09:50:26 +00:00
|
|
|
{% endmacro %}
|
2017-09-27 10:46:52 +01:00
|
|
|
|
|
|
|
|
|
2019-05-15 14:26:51 +01:00
|
|
|
{% macro checkboxes_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text") %}
|
|
|
|
|
{{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style, input="checkbox") }}
|
2019-03-18 16:12:12 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
2019-05-15 14:26:51 +01:00
|
|
|
{% macro checkboxes(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}) %}
|
|
|
|
|
{{ select(field, hint, disable, option_hints, hide_legend, collapsible_opts, input="checkbox") }}
|
2019-02-25 16:23:28 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
2018-11-08 11:56:29 +00:00
|
|
|
{% macro checkbox_input(id, name, data=None, value="y") %}
|
|
|
|
|
<input
|
|
|
|
|
id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ value }}"
|
|
|
|
|
{% if data %}
|
|
|
|
|
checked
|
|
|
|
|
{% endif %}
|
|
|
|
|
>
|
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
{% macro unlabelled_checkbox(id, name, data=None, value="y") %}
|
|
|
|
|
<div class="multiple-choice">
|
|
|
|
|
{{ checkbox_input(id, name, data, value) }}
|
|
|
|
|
<label></label>
|
|
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|