Skip to content

Commit

Permalink
accordion changes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-shaw committed Nov 1, 2023
1 parent 43f05fa commit b1320fd
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions govuk_frontend_jinja/templates/components/accordion/macro.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
{% macro govukAccordion(params) %}
{% from "govuk_frontend_jinja/macros/i18n.html" import govukI18nAttributes %}

{% set id = params.id %}
{% set headingLevel = params.headingLevel if params.headingLevel else 2 %}

<div class="govuk-accordion {%- if params.classes %} {{ params.classes }}{% endif -%}" data-module="govuk-accordion" id="{{ id }}"
{%- if params.hideAllSectionsText %} data-i18n.hide-all-sections="{{ params.hideAllSectionsText | escape }}"{% endif %}
{%- if params.hideSectionText %} data-i18n.hide-section="{{ params.hideSectionText | escape }}"{% endif %}
{%- if params.hideSectionAriaLabelText %} data-i18n.hide-section-aria-label="{{ params.hideSectionAriaLabelText | escape }}"{% endif %}
{{- govukI18nAttributes({
'key': 'hide-all-sections',
'message': params.hideAllSectionsText
}) -}}

{{- govukI18nAttributes({
'key': 'hide-section',
'message': params.hideSectionText
}) -}}

{{- govukI18nAttributes({
'key': 'hide-section-aria-label',
'message': params.hideSectionAriaLabelText
}) -}}

{{- govukI18nAttributes({
'key': 'show-all-sections',
'message': params.showAllSectionsText
}) -}}

{{- govukI18nAttributes({
'key': 'show-section',
'message': params.showSectionText
}) -}}

{{- govukI18nAttributes({
'key': 'show-section-aria-label',
'message': params.showSectionAriaLabelText
}) -}}

{%- if params.rememberExpanded is not undefined %} data-remember-expanded="{{ params.rememberExpanded | escape | lower }}"{% endif %}
{%- if params.showAllSectionsText %} data-i18n.show-all-sections="{{ params.showAllSectionsText | escape }}"{% endif %}
{%- if params.showSectionText %} data-i18n.show-section="{{ params.showSectionText | escape }}"{% endif %}
{%- if params.showSectionAriaLabelText %} data-i18n.show-section-aria-label="{{ params.showSectionAriaLabelText | escape }}"{% endif %}
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}>
{% for item in params['items'] %}
{% if item %}
Expand Down

0 comments on commit b1320fd

Please sign in to comment.