-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from LandRegistry/govuk-frontend-50
GOV.UK Frontend v5.1.0
- Loading branch information
Showing
43 changed files
with
560 additions
and
472 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @matthew-shaw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 61 additions & 33 deletions
94
govuk_frontend_jinja/templates/components/accordion/macro.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,68 @@ | ||
{% macro govukAccordion(params) %} | ||
{% set id = params.id %} | ||
{% set headingLevel = params.headingLevel if params.headingLevel else 2 %} | ||
{% from "govuk_frontend_jinja/macros/i18n.html" import govukI18nAttributes %} | ||
|
||
<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 %} | ||
{%- 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 %} | ||
<div class="govuk-accordion__section {%- if item.expanded %} govuk-accordion__section--expanded{% endif %}"> | ||
<div class="govuk-accordion__section-header"> | ||
<h{{ headingLevel }} class="govuk-accordion__section-heading"> | ||
<span class="govuk-accordion__section-button" id="{{ id }}-heading-{{ loop.index }}"> | ||
{{ item.heading.html | safe if item.heading.html else item.heading.text }} | ||
</span> | ||
</h{{ headingLevel }}> | ||
{% if item.summary and (item.summary.html or item.summary.text) %} | ||
<div class="govuk-accordion__section-summary govuk-body" id="{{ id }}-summary-{{ loop.index }}"> | ||
{{ item.summary.html | safe if item.summary.html else item.summary.text }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
<div id="{{ id }}-content-{{ loop.index }}" class="govuk-accordion__section-content" aria-labelledby="{{ id }}-heading-{{ loop.index }}"> | ||
{% if item.content.html %} | ||
{{ item.content.html | safe }} | ||
{% elif item.content.text %} | ||
<p class="govuk-body">{{ item.content.text }}</p> | ||
{% endif %} | ||
</div> | ||
{%- macro _accordionItem(params, item, index) %} | ||
{%- set headingLevel = params.headingLevel if params.headingLevel else 2 %} | ||
<div class="govuk-accordion__section {%- if item.expanded %} govuk-accordion__section--expanded{% endif %}"> | ||
<div class="govuk-accordion__section-header"> | ||
<h{{ headingLevel }} class="govuk-accordion__section-heading"> | ||
<span class="govuk-accordion__section-button" id="{{ params.id }}-heading-{{ index }}"> | ||
{{ item.heading.html | safe | trim | indent(8) if item.heading.html else item.heading.text }} | ||
</span> | ||
</h{{ headingLevel }}> | ||
{% if item.summary and (item.summary.html or item.summary.text) %} | ||
<div class="govuk-accordion__section-summary govuk-body" id="{{ params.id }}-summary-{{ index }}"> | ||
{{ item.summary.html | safe | trim | indent(8) if item.summary.html else item.summary.text }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
<div id="{{ params.id }}-content-{{ index }}" class="govuk-accordion__section-content"> | ||
{% if item.content.html %} | ||
{{ item.content.html | safe | trim | indent(6) }} | ||
{% elif item.content.text %} | ||
<p class="govuk-body"> | ||
{{ item.content.text | trim | indent(8) }} | ||
</p> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endmacro -%} | ||
|
||
<div class="govuk-accordion {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-accordion" id="{{ params.id }}" | ||
{{- 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 %} | ||
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
{% for item in params['items'] %} | ||
{% if item %}{{ _accordionItem(params, item, loop.index) }}{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% endmacro %} |
5 changes: 2 additions & 3 deletions
5
govuk_frontend_jinja/templates/components/back-link/macro.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{% macro govukBackLink(params) %} | ||
<a href="{%- if params.href %}{{ params.href }}{% else %}#{% endif -%}" class="govuk-back-link{%- if params.classes %} {{ params.classes }}{% endif -%}" | ||
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}>{{ (params.html | safe if params.html else (params.text if params.text else 'Back')) }} | ||
</a> | ||
<a href="{% if params.href %}{{ params.href }}{% else %}#{% endif %}" class="govuk-back-link {%- if params.classes %} {{ params.classes }}{% endif %}" | ||
{%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}>{{ (params.html | safe if params.html else (params.text if params.text else 'Back')) }}</a> | ||
{% endmacro %} |
27 changes: 15 additions & 12 deletions
27
govuk_frontend_jinja/templates/components/breadcrumbs/macro.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
{% macro govukBreadcrumbs(params) %} | ||
{# Set classes for this component #} | ||
{%- set classNames = "govuk-breadcrumbs " -%} | ||
{# Set classes for this component #} | ||
{%- set classNames = "govuk-breadcrumbs" -%} | ||
|
||
{% if params.classes %} | ||
{% set classNames = classNames + params.classes %} | ||
{% set classNames = classNames + " " + params.classes %} | ||
{% endif -%} | ||
|
||
{% if params.collapseOnMobile %} | ||
{% set classNames = classNames + " govuk-breadcrumbs--collapse-on-mobile" %} | ||
{% endif -%} | ||
|
||
<div class="{{classNames}}"{% for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}> | ||
<div class="{{ classNames }}" {%- for attribute, value in (params.attributes.items() if params.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
<ol class="govuk-breadcrumbs__list"> | ||
{% for item in params['items'] %} | ||
{% if item.href %} | ||
{% for item in params['items'] %} | ||
{% if item.href %} | ||
<li class="govuk-breadcrumbs__list-item"> | ||
<a class="govuk-breadcrumbs__link" href="{{ item.href }}"{% for attribute, value in (item.attributes.items() if item.attributes else {}.items()) %} {{attribute}}="{{value}}"{% endfor %}>{{ item.html | safe if item.html else item.text }}</a> | ||
<a class="govuk-breadcrumbs__link" href="{{ item.href }}" {%- for attribute, value in (item.attributes.items() if item.attributes else {}.items()) %} {{ attribute }}="{{ value }}"{% endfor %}> | ||
{{- item.html | safe if item.html else item.text -}} | ||
</a> | ||
</li> | ||
{% else %} | ||
<li class="govuk-breadcrumbs__list-item" aria-current="page">{{ item.html | safe if item.html else item.text }}</li> | ||
{% endif %} | ||
{% endfor %} | ||
{% else %} | ||
<li class="govuk-breadcrumbs__list-item" aria-current="page"> | ||
{{- item.html | safe if item.html else item.text -}} | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
</ol> | ||
</div> | ||
|
||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.