Skip to content

Commit

Permalink
rename items summary param for compatibility with jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccar committed Oct 7, 2024
1 parent 9c217a1 commit 0317f91
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/components/summary/_macro-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| Name | Type | Required | Description |
| ------------ | ----------------------- | -------- | ------------------------------------------------------------------- |
| id | string | false | The HTML `id` of the row |
| items | Array`<SummaryRowItem>` | true | An array of [items for the row](#summaryrowitem) |
| itemsList | Array`<SummaryRowItem>` | true | An array of [items for the row](#summaryrowitem) |
| title | string | false | The title for the row |
| error | boolean | false | Set to “true” display an [error](/components/error) on a row |
| errorMessage | string | false | The error message for the row |
Expand Down
4 changes: 2 additions & 2 deletions src/components/summary/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
{% if row.errorMessage %}
<div class="ons-summary__row-title--error ons-u-fs-r">{{ row.errorMessage }}</div>
{% endif %}
{% if row.items | length > 1 and row.title %}
{% if row.itemsList | length > 1 and row.title %}
<div class="ons-summary__row-title ons-summary__row-title--no-group-title ons-u-fs-r">
{{- row.title -}}
</div>
{% endif %}

{% for item in row.items %}
{% for item in row.itemsList %}
<div
class="ons-summary__row{{ ' ons-summary__row--has-values' if item.valueList else "" }}"
{% if item.id %}id="{{ item.id }}"{% endif %}
Expand Down
12 changes: 6 additions & 6 deletions src/components/summary/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const EXAMPLE_SUMMARY_ROWS = {
// Contains - row with icon, attributes and titleAttributes, other value, no action
id: 'row-id-1',
title: 'row title 1',
items: [
itemsList: [
{
titleAttributes: {
a: 123,
Expand Down Expand Up @@ -39,7 +39,7 @@ const EXAMPLE_SUMMARY_ROWS = {
title: 'row title 2',
error: true,
errorMessage: 'there are errors',
items: [
itemsList: [
{
id: 'item-id-2',
valueList: [
Expand Down Expand Up @@ -70,7 +70,7 @@ const EXAMPLE_SUMMARY_ROWS = {
// Contains - row with multiple rows and multiple values
id: 'row-id-3',
title: 'row title 3',
items: [
itemsList: [
{
id: 'item-id-3',
valueList: [
Expand All @@ -97,7 +97,7 @@ const EXAMPLE_SUMMARY_ROWS = {
id: 'row-id-4',
title: 'row title 4',
total: true,
items: [
itemsList: [
{
id: 'item-id-5',
valueList: [
Expand Down Expand Up @@ -139,7 +139,7 @@ const EXAMPLE_SUMMARY_GROUPS_NO_ROWS = {
const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
rows: [
{
items: [
itemsList: [
{
title: 'row item 1',
valueList: [
Expand Down Expand Up @@ -193,7 +193,7 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
],
},
{
items: [
itemsList: [
{
title: 'row item 4',
valueList: [
Expand Down
20 changes: 10 additions & 10 deletions src/components/summary/example-summary-card-grouped.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"rows": [
{
"title": "Are you John Doe?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -31,7 +31,7 @@
},
{
"title": "What's your date of birth?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -50,7 +50,7 @@
},
{
"title": "What is your sex?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -74,7 +74,7 @@
"rows": [
{
"title": "What is your country of birth?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -93,7 +93,7 @@
},
{
"title": "What passports do you hold?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -117,7 +117,7 @@
"rows": [
{
"title": "Have you completed an apprenticeship?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -136,7 +136,7 @@
},
{
"title": "Have you achieved a GCSE or equivalent qualification?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -159,7 +159,7 @@
"title": "Employment history",
"rows": [
{
"items": [
"itemsList": [
{
"title": "Name of UK company",
"valueList": [
Expand Down Expand Up @@ -213,7 +213,7 @@
]
},
{
"items": [
"itemsList": [
{
"title": "Name of UK company",
"valueList": [
Expand Down Expand Up @@ -280,7 +280,7 @@
"rows": [
{
"title": "What are your monthly household expenses?",
"items": [
"itemsList": [
{
"title": "Food",
"valueList": [
Expand Down
6 changes: 3 additions & 3 deletions src/components/summary/example-summary-grouped-total.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"title": "Summary - Section Title",
"rows": [
{
"items": [
"itemsList": [
{
"title": "Total value of acquisitions for transport assets and equipment",
"valueList": [
Expand All @@ -27,7 +27,7 @@
]
},
{
"items": [
"itemsList": [
{
"title": "Total value of acquisitions for computers and peripheral devices (hardware)",
"valueList": [
Expand All @@ -47,7 +47,7 @@
},
{
"total": true,
"items": [
"itemsList": [
{
"title": "Grand total for value of acquisitions",
"valueList": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rows": [
{
"title": "For the period 1 May 2017 to 31 May 2017, what was the total turnover of Essential Enterprise Ltd?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -30,7 +30,7 @@
"title": "What was the value of the business's total sales of food?",
"errorMessage": "Change one or more of the figures so they sum to £600",
"error": true,
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -50,7 +50,7 @@
{
"title": "What was the value of the business's total sales of alcohol, confectionery and tobacco?",
"error": true,
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -70,7 +70,7 @@
{
"title": "What was the value of the business's total sales of clothing and footwear?",
"error": true,
"items": [
"itemsList": [
{
"valueList": [
{
Expand Down
20 changes: 10 additions & 10 deletions src/components/summary/example-summary-grouped.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"rows": [
{
"title": "Are you John Doe?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -32,7 +32,7 @@
},
{
"title": "What's your date of birth?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -51,7 +51,7 @@
},
{
"title": "What is your sex?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -75,7 +75,7 @@
"rows": [
{
"title": "What is your country of birth?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -94,7 +94,7 @@
},
{
"title": "What passports do you hold?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -118,7 +118,7 @@
"rows": [
{
"title": "Have you completed an apprenticeship?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -137,7 +137,7 @@
},
{
"title": "Have you achieved a GCSE or equivalent qualification?",
"items": [
"itemsList": [
{
"valueList": [
{
Expand All @@ -160,7 +160,7 @@
"title": "Employment history",
"rows": [
{
"items": [
"itemsList": [
{
"title": "Name of UK company",
"valueList": [
Expand Down Expand Up @@ -214,7 +214,7 @@
]
},
{
"items": [
"itemsList": [
{
"title": "Name of UK company",
"valueList": [
Expand Down Expand Up @@ -281,7 +281,7 @@
"rows": [
{
"title": "What are your monthly household expenses?",
"items": [
"itemsList": [
{
"title": "Food",
"valueList": [
Expand Down
6 changes: 3 additions & 3 deletions src/components/summary/example-summary-household.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"rows": [
{
"title": "Joe Bloggs (You)",
"items": [
"itemsList": [
{
"iconType": "person",
"actions": [
Expand All @@ -25,7 +25,7 @@
},
{
"title": "Barry Scott",
"items": [
"itemsList": [
{
"iconType": "person",
"actions": [
Expand All @@ -45,7 +45,7 @@
},
{
"title": "Wilhelmina Susannah Clementine-Smith",
"items": [
"itemsList": [
{
"iconType": "person",
"actions": [
Expand Down
8 changes: 4 additions & 4 deletions src/components/summary/example-summary-hub-minimal.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"rows": [
{
"title": "People who live here",
"items": [
"itemsList": [
{
"iconType": "check",
"iconVisuallyHiddenText": "Section complete",
Expand All @@ -26,7 +26,7 @@
},
{
"title": "Mary Smith (You)",
"items": [
"itemsList": [
{
"iconType": "check",
"iconVisuallyHiddenText": "Section complete",
Expand All @@ -42,7 +42,7 @@
},
{
"title": "John Smith",
"items": [
"itemsList": [
{
"actions": [
{
Expand All @@ -56,7 +56,7 @@
},
{
"title": "Billy Smith",
"items": [
"itemsList": [
{
"actions": [
{
Expand Down
Loading

0 comments on commit 0317f91

Please sign in to comment.