Skip to content

Commit

Permalink
Made empty arrays behave the same as no array.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat Carey committed Nov 20, 2019
1 parent f26c242 commit 3fb2161
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/govuk/components/date-input/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
aria-describedby – for example hints or error messages -#}
{% set describedBy = params.fieldset.describedBy if params.fieldset.describedBy else "" %}

{% if params.items %}
{% if params.items | length %}
{% set dateInputItems = params.items %}
{% else %}
{% set dateInputItems = [
Expand Down
6 changes: 3 additions & 3 deletions src/govuk/components/footer/template.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<footer class="govuk-footer {{ params.classes if params.classes }}" role="contentinfo"
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
<div class="govuk-width-container {{ params.containerClasses if params.containerClasses }}">
{% if params.navigation %}
{% if params.navigation | length %}
<div class="govuk-footer__navigation">
{% for nav in params.navigation %}
<div class="govuk-footer__section">
<h2 class="govuk-footer__heading govuk-heading-m">{{ nav.title }}</h2>
{% if nav.items %}
{% if nav.items | length %}
{% set listClasses %}
{% if nav.columns %}
govuk-footer__list--columns-{{ nav.columns }}
Expand All @@ -33,7 +33,7 @@
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
{% if params.meta %}
<h2 class="govuk-visually-hidden">{{ params.meta.visuallyHiddenTitle | default("Support links") }}</h2>
{% if params.meta.items %}
{% if params.meta.items | length %}
<ul class="govuk-footer__inline-list">
{% for item in params.meta.items %}
<li class="govuk-footer__inline-list-item">
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/summary-list/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{# Determine if we need 2 or 3 columns #}
{% set anyRowHasActions = false %}
{% for row in params.rows %}
{% set anyRowHasActions = true if row.actions.items else anyRowHasActions %}
{% set anyRowHasActions = true if row.actions.items | length else anyRowHasActions %}
{% endfor -%}

<dl class="govuk-summary-list {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/tabs/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h2 class="govuk-tabs__title">
{{ params.title | default ("Contents") }}
</h2>
{% if(params.items) %}
{% if(params.items | length) %}
<ul class="govuk-tabs__list">
{% for item in params.items %}
{% if item %}
Expand Down

0 comments on commit 3fb2161

Please sign in to comment.