2019-02-25 16:23:28 +00:00
|
|
|
{% from "components/select-input.html" import select, select_list, select_nested, select_wrapper, select_input %}
|
2019-02-25 14:55:26 +00:00
|
|
|
|
2019-10-09 16:16:22 +01:00
|
|
|
{% macro radios(field, hint=None, disable=[], option_hints={}, hide_legend=False, inline=False) %}
|
|
|
|
|
{{ select(field, hint, disable, option_hints, hide_legend, input="radio", inline=inline) }}
|
2018-06-12 13:17:45 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
2018-12-18 14:40:53 +00:00
|
|
|
|
2019-02-25 14:55:26 +00:00
|
|
|
{% macro radio_list(options, child_map, disable=[], option_hints={}) %}
|
2019-02-25 16:23:28 +00:00
|
|
|
{{ select_list(options, child_map, disable, option_hints, input="radio") }}
|
2018-12-18 14:40:53 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
2019-02-25 14:55:26 +00:00
|
|
|
{% macro radios_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False) %}
|
2019-02-25 16:23:28 +00:00
|
|
|
{{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, input="radio") }}
|
2016-06-29 17:10:49 +01:00
|
|
|
{% endmacro %}
|
2016-08-08 10:28:40 +01:00
|
|
|
|
2019-02-25 14:55:26 +00:00
|
|
|
|
2018-12-18 14:40:53 +00:00
|
|
|
{% macro radio(option, disable=[], option_hints={}, data_target=None, as_list_item=False) %}
|
2019-02-25 16:23:28 +00:00
|
|
|
{{ select_input(option, disable, option_hints, data_target, as_list_item, input="radio") }}
|
2018-05-18 14:05:48 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
2016-08-07 09:17:49 +01:00
|
|
|
{% macro radio_select(
|
|
|
|
|
field,
|
|
|
|
|
hint=None,
|
|
|
|
|
wrapping_class='form-group'
|
|
|
|
|
) %}
|
2017-04-10 11:16:22 +01:00
|
|
|
<div class="{{ wrapping_class }} {% if field.errors %} form-group-error{% endif %}">
|
2016-08-07 09:17:49 +01:00
|
|
|
<fieldset>
|
|
|
|
|
<legend class="form-label">
|
2017-02-13 09:50:26 +00:00
|
|
|
{{ field.label.text }}
|
2016-08-07 09:17:49 +01:00
|
|
|
{% if field.errors %}
|
2017-10-16 14:58:08 +01:00
|
|
|
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
2016-08-07 09:17:49 +01:00
|
|
|
{{ field.errors[0] }}
|
|
|
|
|
</span>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</legend>
|
2016-10-11 14:17:29 +01:00
|
|
|
<div class="radio-select" data-module="radio-select" data-categories="{{ field.categories|join(',') }}">
|
2016-08-07 09:17:49 +01:00
|
|
|
<div class="radio-select-column">
|
|
|
|
|
{% for option in field %}
|
2016-12-19 10:36:17 +00:00
|
|
|
<div class="multiple-choice">
|
2016-08-07 09:17:49 +01:00
|
|
|
{{ option }}
|
2016-12-19 10:36:17 +00:00
|
|
|
<label for="{{ option.id }}">
|
|
|
|
|
{{ option.label.text }}
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
2016-08-07 09:17:49 +01:00
|
|
|
{% if loop.first %}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="radio-select-column">
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
2018-06-12 14:29:47 +01:00
|
|
|
{% macro conditional_radio_panel(id) %}
|
2019-09-05 12:10:24 +01:00
|
|
|
<div class="conditional-radios-panel js-hidden" id="{{ id }}">
|
2018-06-12 14:29:47 +01:00
|
|
|
{{ caller() }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endmacro %}
|