Skip to content

Commit ecec1e0

Browse files
FLS-1409: change mark as a complete component to a standard component to use with gov-uk macro and added error summary change (#203)
1 parent 2be61f2 commit ecec1e0

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

runner/src/server/views/summary.html

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% from "partials/summary-detail.html" import summaryDetail %}
22
{% from "components/checkboxes/macro.njk" import govukCheckboxes %}
3+
{% from "components/radios/macro.njk" import govukRadios %}
4+
{% from "components/error-summary/macro.njk" import govukErrorSummary %}
35
{% from "button/macro.njk" import govukButton %}
46
{% extends 'layout.html' %}
57

@@ -30,6 +32,14 @@
3032
{% if not hasMultipleSections and not details[0].hideTitle %}
3133
<span class="govuk-caption-l">{{ details[0].title }}</span>
3234
{% endif %}
35+
36+
{% if markAsCompleteComponent and markAsCompleteError %}
37+
{{ govukErrorSummary({
38+
titleText: "There is a problem",
39+
errorList: [{ text: markAsCompleteError, href: "#markAsComplete-error" }]
40+
}) }}
41+
{% endif %}
42+
3343
<h1 class="govuk-heading-l">
3444
{% if callback and callback.title %}
3545
{{ callback.title }}
@@ -98,40 +108,39 @@ <h2 class="govuk-heading-m" id="declaration">Declaration</h2>
98108
{% endif %}
99109

100110
{% if markAsCompleteComponent %}
101-
<div class="govuk-!-margin-top-9 govuk-form-group {{ 'govuk-form-group--error' if markAsCompleteError }}">
102-
{% if markAsCompleteError %}
103-
<span id="nationality-error" class="govuk-error-message">
104-
<span class="govuk-visually-hidden">Error:</span> {{ markAsCompleteError }}</span>
105-
{% endif %}
106-
<fieldset class="govuk-fieldset">
107-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
108-
<h1 class="govuk-fieldset__heading">
109-
{{ i18nGetTranslation("markAsComplete") }}
110-
</h1>
111-
</legend>
112-
<div class="govuk-radios" data-module="govuk-radios">
113-
<div class="govuk-radios__item">
114-
<input class="govuk-radios__input" id="markAsComplete-yes"
115-
name="markAsComplete" type="radio" value="true"
116-
{% if markAsComplete %}checked{% endif %}>
117-
<label class="govuk-label govuk-radios__label" for="markAsComplete-yes">
118-
{{ i18nGetTranslation("components.sectionCompletedField.yes") }}
119-
</label>
120-
<div class="govuk-hint govuk-radios__hint">
121-
{{ i18nGetTranslation("components.sectionCompletedField.hint") }}
122-
</div>
123-
</div>
124-
<div class="govuk-radios__item">
125-
<input class="govuk-radios__input" id="markAsComplete-no"
126-
name="markAsComplete" type="radio" value="false"
127-
{% if markAsComplete == false %}checked{% endif %}>
128-
<label class="govuk-label govuk-radios__label" for="markAsComplete-no">
129-
{{ i18nGetTranslation("components.sectionCompletedField.no") }}
130-
</label>
131-
</div>
132-
</div>
133-
</fieldset>
134-
</div>
111+
{% if markAsCompleteError %}
112+
{% set errorMessageObj = { text: markAsCompleteError } %}
113+
{% else %}
114+
{% set errorMessageObj = null %}
115+
{% endif %}
116+
{{ govukRadios({
117+
name: "markAsComplete",
118+
fieldset: {
119+
legend: {
120+
text: i18nGetTranslation("markAsComplete"),
121+
isPageHeading: false,
122+
classes: "govuk-fieldset__legend--m"
123+
}
124+
},
125+
items: [
126+
{
127+
value: true,
128+
text: i18nGetTranslation("components.sectionCompletedField.yes"),
129+
id: "markAsComplete-yes",
130+
checked: (markAsComplete === true),
131+
hint: {
132+
text: i18nGetTranslation("components.sectionCompletedField.hint")
133+
}
134+
},
135+
{
136+
value: false,
137+
checked: (markAsComplete === false),
138+
id: "markAsComplete-no",
139+
text: i18nGetTranslation("components.sectionCompletedField.no")
140+
}
141+
],
142+
errorMessage: errorMessageObj
143+
}) }}
135144
{% endif %}
136145

137146
{% if fees and fees.details|length %}

0 commit comments

Comments
 (0)