{% macro govukSummaryList(params) %} {%- macro _actionLink(action) %} {{ action.html | safe if action.html else action.text }} {%- if action.visuallyHiddenText -%} {{ action.visuallyHiddenText }} {% endif -%} {% endmacro -%} {%- macro _summaryCard(params) %} {%- set headingLevel = params.title.headingLevel if params.title and params.title.headingLevel else 2 -%}
{%- if params.title -%} {{- params.title.html | safe if params.title.html else params.title.text -}} {%- endif -%} {%- if params.actions and params.actions['items'] | length -%} {%- if params.actions['items'] | length == 1 -%}
{{- _actionLink(params.actions['items'][0]) -}}
{%- else -%} {% endif -%} {%- endif -%}
{{- caller() -}}
{% endmacro -%} {# Determine if we need 2 or 3 columns #} {% set ns = namespace(anyRowHasActions = False) %} {% for row in params.rows %} {% set ns.anyRowHasActions = True if row.actions and row.actions['items'] | length else ns.anyRowHasActions %} {% endfor -%} {%- set summaryList -%}
{% for row in params.rows %} {% if row %}
{{ row.key.html | indent(4 if params.card else 0) | safe if row.key.html else row.key.text }}
{{ row.value.html | indent(12 if params.card else 8) | trim | safe if row.value.html else row.value.text }}
{% if row.actions and row.actions['items'] | length %}
{% if row.actions and row.actions['items'] | length == 1 %} {{ _actionLink(row.actions['items'][0]) | indent(16 if params.card else 12) | trim }} {% else %}
    {%- for action in row.actions['items'] -%}
  • {{- _actionLink(action) | indent(22 if params.card else 18) | trim -}}
  • {%- endfor -%}
{% endif %}
{% endif %}
{% endif %} {% endfor %}
{%- endset %} {%- if params.card -%} {% call _summaryCard(params.card) -%} {{ summaryList | safe }} {%- endcall %} {%- else -%} {{ summaryList | safe }} {%- endif %} {% endmacro %}