diff --git a/govuk_frontend_jinja/templates/components/checkboxes/macro.html b/govuk_frontend_jinja/templates/components/checkboxes/macro.html index 0fb7f60b..a45d0dfb 100644 --- a/govuk_frontend_jinja/templates/components/checkboxes/macro.html +++ b/govuk_frontend_jinja/templates/components/checkboxes/macro.html @@ -18,7 +18,7 @@ {% endif %} {#- fieldset is false by default -#} -{% set hasFieldset = True if params.fieldset else False %} +{% set hasFieldset = true if params.fieldset else false %} {#- Capture the HTML so we can optionally nest it in a fieldset -#} {% set innerHtml %} @@ -31,7 +31,7 @@ 'attributes': params.hint.attributes, 'html': params.hint.html, 'text': params.hint.text - }) | indent(2) | trim }} + }) | trim | indent(2) }} {% endif %} {% if params.errorMessage %} {% set errorId = idPrefix + '-error' %} @@ -43,7 +43,7 @@ 'html': params.errorMessage.html, 'text': params.errorMessage.text, 'visuallyHiddenText': params.errorMessage.visuallyHiddenText - }) | indent(2) | trim }} + }) | trim | indent(2) }} {% endif %}
@@ -65,8 +65,8 @@ {%- if item.divider %}
{{ item.divider }}
{%- else %} - {% set isChecked = item.checked | default((item.value in params.get('values', []) and item.checked != False) if params.values else false, true) %} - {% set hasHint = True if item.hint and (item.hint.text or item.hint.html) %} + {% set isChecked = item.checked | default((item.value in params.get('values', []) and item.checked != false) if params.values else false, true) %} + {% set hasHint = true if item.hint and (item.hint.text or item.hint.html) %} {% set itemHintId = id + "-item-hint" if hasHint else "" %} {% set itemDescribedBy = ns.describedBy if not hasFieldset else "" %} {% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %} @@ -84,7 +84,7 @@ 'classes': 'govuk-checkboxes__label' + (' ' + item.label.classes if item.label and item.label.classes else ''), 'attributes': item.label.attributes if item.label, 'for': id - }) | indent(6) | trim }} + }) | trim | indent(6) }} {% if hasHint %} {{ govukHint({ 'id': itemHintId, @@ -92,7 +92,7 @@ 'attributes': item.hint.attributes, 'html': item.hint.html, 'text': item.hint.text - }) | indent(6) | trim }} + }) | trim | indent(6) }} {% endif %}
{% if item.conditional and item.conditional.html %} @@ -106,18 +106,17 @@ {% endset -%} -
-{% if params.fieldset %} - {% call govukFieldset({ +
+{% if hasFieldset %} + {{ govukFieldset({ 'describedBy': ns.describedBy, 'classes': params.fieldset.classes, 'attributes': params.fieldset.attributes, - 'legend': params.fieldset.legend - }) %} - {{ innerHtml | trim | safe }} - {% endcall %} + 'legend': params.fieldset.legend, + 'html': innerHtml | trim + }) | trim | indent(2) }} {% else %} - {{ innerHtml | trim | safe }} + {{ innerHtml | safe | trim }} {% endif %}
{% endmacro %} \ No newline at end of file