-
Notifications
You must be signed in to change notification settings - Fork 232
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 #2039 from alphagov/remove-error-summary-hack
Remove error summary override `init` function
- Loading branch information
Showing
12 changed files
with
254 additions
and
29 deletions.
There are no files selected for viewing
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,20 @@ | ||
--- | ||
title: Error summary | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
|
||
{{ govukErrorSummary({ | ||
titleText: "There is a problem", | ||
errorList: [ | ||
{ | ||
text: "The date your passport was issued must be in the past", | ||
href: "#passport-issued-day" | ||
}, | ||
{ | ||
text: "Enter a postcode, like AA1 1AA", | ||
href: "#postcode-input" | ||
} | ||
] | ||
}) }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Full page example | ||
layout: layout-example-full-page.njk | ||
--- | ||
|
||
{% extends "example-wrappers/full-page.njk" %} | ||
|
||
{% from "govuk/components/back-link/macro.njk" import govukBackLink %} | ||
{% from "govuk/components/button/macro.njk" import govukButton %} | ||
{% from "govuk/components/date-input/macro.njk" import govukDateInput %} | ||
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
|
||
{% block beforeContent %} | ||
{{ govukBackLink({ | ||
text: "Back" | ||
}) }} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<form action="/form-handler" method="post" novalidate> | ||
{{ govukErrorSummary({ | ||
titleText: "There is a problem", | ||
errorList: [ | ||
{ | ||
text: "Passport issue date must include a year", | ||
href: "#passport-issued-year" | ||
} | ||
] | ||
}) }} | ||
|
||
{{ govukDateInput({ | ||
fieldset: { | ||
legend: { | ||
isPageHeading: true, | ||
text: 'When was your passport issued?', | ||
classes: 'govuk-fieldset__legend--l' | ||
} | ||
}, | ||
id: 'passport-issued', | ||
namePrefix: 'passport-issued', | ||
errorMessage: { | ||
text: "Passport issue date must include a year" | ||
}, | ||
items: [ | ||
{ | ||
name: "day", | ||
classes: "govuk-input--width-2", | ||
value: 5 | ||
}, | ||
{ | ||
name: "month", | ||
classes: "govuk-input--width-2", | ||
value: 12 | ||
}, | ||
{ | ||
name: "year", | ||
classes: "govuk-input--width-4 govuk-input--error" | ||
} | ||
] | ||
}) | ||
}} | ||
|
||
{{ govukButton({ | ||
text: "Continue" | ||
}) }} | ||
|
||
</form> | ||
</div> | ||
</div> | ||
{% endblock %} |
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
53 changes: 53 additions & 0 deletions
53
src/components/error-summary/linking-checkboxes-radios/code.njk
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,53 @@ | ||
--- | ||
title: Linking from the error summary to checkboxes | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
{% from "govuk/components/checkboxes/macro.njk" import govukCheckboxes %} | ||
|
||
{{ govukErrorSummary({ | ||
titleText: "There is a problem", | ||
errorList: [ | ||
{ | ||
text: "Select if you are British, Irish or a citizen of a different country", | ||
href: "#nationality" | ||
} | ||
] | ||
}) }} | ||
|
||
{{ govukCheckboxes({ | ||
idPrefix: "nationality", | ||
name: "nationality", | ||
fieldset: { | ||
legend: { | ||
text: "What is your nationality?", | ||
isPageHeading: true, | ||
classes: "govuk-fieldset__legend--l" | ||
} | ||
}, | ||
hint: { | ||
text: "If you have dual nationality, select all options that are relevant to you." | ||
}, | ||
errorMessage: { | ||
text: "Select if you are British, Irish or a citizen of a different country" | ||
}, | ||
items: [ | ||
{ | ||
value: "british", | ||
text: "British", | ||
hint: { | ||
text: "including English, Scottish, Welsh and Northern Irish" | ||
} | ||
}, | ||
{ | ||
value: "irish", | ||
text: "Irish" | ||
}, | ||
{ | ||
value: "other", | ||
text: "Citizen of another country" | ||
} | ||
] | ||
}) }} | ||
|
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
49 changes: 49 additions & 0 deletions
49
src/components/error-summary/linking-multiple-fields/code.njk
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,49 @@ | ||
--- | ||
title: Linking from the error summary to an answer that uses multiple fields | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from "govuk/components/date-input/macro.njk" import govukDateInput %} | ||
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
|
||
{{ govukErrorSummary({ | ||
titleText: "There is a problem", | ||
errorList: [ | ||
{ | ||
text: "Passport issue date must include a year", | ||
href: "#passport-issued-year" | ||
} | ||
] | ||
}) }} | ||
|
||
{{ govukDateInput({ | ||
fieldset: { | ||
legend: { | ||
isPageHeading: true, | ||
text: 'When was your passport issued?', | ||
classes: 'govuk-fieldset__legend--l' | ||
} | ||
}, | ||
id: 'passport-issued', | ||
namePrefix: 'passport-issued', | ||
errorMessage: { | ||
text: "Passport issue date must include a year" | ||
}, | ||
items: [ | ||
{ | ||
name: "day", | ||
classes: "govuk-input--width-2", | ||
value: 5 | ||
}, | ||
{ | ||
name: "month", | ||
classes: "govuk-input--width-2", | ||
value: 12 | ||
}, | ||
{ | ||
name: "year", | ||
classes: "govuk-input--width-4 govuk-input--error" | ||
} | ||
] | ||
}) | ||
}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Linking from the error summary to an answer that uses a single field | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
{% from "govuk/components/input/macro.njk" import govukInput %} | ||
|
||
{{ govukErrorSummary({ | ||
titleText: "There is a problem", | ||
errorList: [ | ||
{ | ||
text: "Enter your full name", | ||
href: "#full-name-input" | ||
} | ||
] | ||
}) }} | ||
|
||
<h1 class="govuk-heading-l">Your details</h1> | ||
|
||
{{ govukInput({ | ||
label: { | ||
text: 'Full name' | ||
}, | ||
id: "full-name-input", | ||
name: "name", | ||
autocomplete: "name", | ||
errorMessage: { | ||
text: "Enter your full name" | ||
} | ||
}) }} | ||
|
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