-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_summary-list.html
37 lines (37 loc) · 1.65 KB
/
_summary-list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{% macro govukSummaryList(params) %}
{%- macro _actionLink(action) %}
<a class="govuk-link" href="{{ action.href }}">
{{ action.html | safe if action.html else action.text }}
{%- if action.visuallyHiddenText -%}
<span class="nhsuk-u-visually-hidden"> {{ action.visuallyHiddenText }}</span>
{% endif -%}
</a>
{% endmacro -%}
<dl class="govuk-summary-list {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
{% for row in params.rows %}
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key {%- if row.key.classes %} {{ row.key.classes }}{% endif %}">
{{ row.key.html | safe if row.key.html else row.key.text }}
</dt>
<dd class="govuk-summary-list__value {%- if row.value.classes %} {{ row.value.classes }}{% endif %}">
{{ row.value.html | indent(8) | trim | safe if row.value.html else row.value.text }}
</dd>
{% if row.actions.items %}
<dd class="govuk-summary-list__actions {%- if row.actions.classes %} {{ row.actions.classes }}{% endif %}">
{% if row.actions.items.length == 1 %}
{{ _actionLink(row.actions.items[0]) | indent(12) | trim }}
{% else %}
<ul class="govuk-summary-list__actions-list">
{% for action in row.actions.items %}
<li class="govuk-summary-list__actions-list-item">
{{ _actionLink(action) | indent(18) | trim }}
</li>
{% endfor %}
</ul>
{% endif %}
</dd>
{% endif %}
</div>
{% endfor %}
</dl>
{% endmacro %}