mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 03:44:38 -05:00
Expands the API of the macro to allow nested checkboxes to have a summary tracking the current selection, the fieldset to expand/collapse and buttons to be added to allow jumping between states. Includes making 'Done' button inline on mobile. Helps differentiate it form the form submit.
47 lines
1.3 KiB
HTML
47 lines
1.3 KiB
HTML
{% from "components/select-input.html" import select_nested, select %}
|
|
|
|
{% macro checkbox(
|
|
field,
|
|
hint=False,
|
|
width='2-3'
|
|
) %}
|
|
<div class="multiple-choice">
|
|
{{ checkbox_input(field.id, field.name, field.data) }}
|
|
<label for="{{ field.id }}">
|
|
{{ field.label.text }}
|
|
{% if hint %}
|
|
<div class="hint">
|
|
{{ hint }}
|
|
</div>
|
|
{% endif %}
|
|
</label>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
|
|
{% 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") }}
|
|
{% endmacro %}
|
|
|
|
|
|
{% 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") }}
|
|
{% endmacro %}
|
|
|
|
|
|
{% 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 %}
|