Files
notifications-admin/app/templates/components/checkbox.html
Chris Hill-Scott d58be228dd Fix new checkboxes
Problems:
- WTForms expects the value of checkboxes to always be `y` (they don’t
  work like radio buttons, which is where I copied this code for)
- WTForms `BooleanField`s don’t have a checked attribute, they set their
  data attibute to `True` or `False`
2017-04-11 17:47:16 +01:00

23 lines
446 B
HTML

{% macro checkbox(
field,
hint=False,
width='2-3'
) %}
<div class="multiple-choice">
<input
id="{{ field.id }}" name="{{ field.name }}" type="checkbox" value="y"
{% if field.data %}
checked
{% endif %}
>
<label for="{{ field.id }}">
{{ field.label.text }}
{% if hint %}
<div class="hint">
{{ hint }}
</div>
{% endif %}
</label>
</div>
{% endmacro %}