diff --git a/internal/templatefn/fn.go b/internal/templatefn/fn.go index 64c487cc5a..f21ba06ee9 100644 --- a/internal/templatefn/fn.go +++ b/internal/templatefn/fn.go @@ -88,6 +88,9 @@ func All(globals *Globals) map[string]any { "lpaDecisions": lpaDecisions, "summaryRow": summaryRow, "staticSummaryRow": staticSummaryRow, + "legend": legend, + "legendHeading": legendHeading, + "fieldset": fieldset, } } @@ -524,3 +527,40 @@ func staticSummaryRow(app appcontext.Data, label string, value any) map[string]a "Static": true, } } + +type legendData struct { + Label string + Classes string + H1 bool +} + +func legend(label string, classes ...string) legendData { + return legendData{ + Label: label, + Classes: strings.Join(classes, " "), + } +} + +func legendHeading(label string, classes ...string) legendData { + return legendData{ + Label: label, + Classes: strings.Join(classes, " "), + H1: true, + } +} + +type fieldsetData struct { + Top any + Name string + Legend legendData + Items map[string]any +} + +func fieldset(top any, name string, value any, legend legendData, is ...any) fieldsetData { + return fieldsetData{ + Top: top, + Name: name, + Legend: legend, + Items: items(top, name, value, is...), + } +} diff --git a/internal/templatefn/fn_test.go b/internal/templatefn/fn_test.go index a4df820ca7..6d6807a93f 100644 --- a/internal/templatefn/fn_test.go +++ b/internal/templatefn/fn_test.go @@ -597,3 +597,30 @@ func TestStaticSummaryRow(t *testing.T) { "Static": true, }, staticSummaryRow(app, label, value)) } + +func TestLegend(t *testing.T) { + assert.Equal(t, legendData{ + Label: "a-label", + Classes: "class-1 class-2", + }, legend("a-label", "class-1", "class-2")) +} + +func TestLegendHeading(t *testing.T) { + assert.Equal(t, legendData{ + Label: "a-label", + Classes: "class-1 class-2", + H1: true, + }, legendHeading("a-label", "class-1", "class-2")) +} + +func TestFieldset(t *testing.T) { + aLegend := legend("a-label") + anItem := item("a-value", "another-label") + + assert.Equal(t, fieldsetData{ + Top: "top", + Name: "a-name", + Legend: aLegend, + Items: items("top", "a-name", "a-value", anItem), + }, fieldset("top", "a-name", "a-value", aLegend, anItem)) +} diff --git a/web/template/attorney/sign.gohtml b/web/template/attorney/sign.gohtml index 7504e3e13b..3b7732ed75 100644 --- a/web/template/attorney/sign.gohtml +++ b/web/template/attorney/sign.gohtml @@ -1,115 +1,117 @@ {{ template "page" . }} {{ define "pageTitle" }} - {{ if .App.IsTrustCorporation }} - {{ tr .App "signOnBehalfOfTrustCorporation" }} - {{ else if .IsReplacement }} - {{ tr .App "signAsReplacementAttorney" }} - {{ else }} - {{ tr .App "signAsAttorney" }} - {{ end }} + {{ if .App.IsTrustCorporation }} + {{ tr .App "signOnBehalfOfTrustCorporation" }} + {{ else if .IsReplacement }} + {{ tr .App "signAsReplacementAttorney" }} + {{ else }} + {{ tr .App "signAsAttorney" }} + {{ end }} {{ end }} {{ define "main" }} -
-
-

- {{ template "pageTitle" . }} -

+
+
+

+ {{ template "pageTitle" . }} +

- {{ if .App.IsTrustCorporation }} - {{ if .IsSecondSignatory }} -

- - {{ tr .App "theTrustCorporationNoLongerRequiresSecondSignatory" }} - -

- {{ else }} -

{{ tr .App "youCanChooseToAddSignatoryOnNextPage" }}

- {{ end }} - {{ end }} - - {{ template "warning" (content .App "lpaCantBeRegisteredUntilAttorneysSign") }} + {{ if .App.IsTrustCorporation }} + {{ if .IsSecondSignatory }} +

+ + {{ tr .App "theTrustCorporationNoLongerRequiresSecondSignatory" }} + +

+ {{ else }} +

{{ tr .App "youCanChooseToAddSignatoryOnNextPage" }}

+ {{ end }} + {{ end }} -
- {{ if .App.IsTrustCorporation }} -
- - {{ tr .App "authorisedSignatory" }} - + {{ template "warning" (content .App "lpaCantBeRegisteredUntilAttorneysSign") }} - {{ template "input" (input . "first-names" "firstNames" .Form.FirstNames "classes" "govuk-input--width-20" "hint" "firstNamesHint") }} - {{ template "input" (input . "last-name" "lastName" .Form.LastName "classes" "govuk-input--width-20") }} - {{ template "input" (input . "professional-title" "professionalTitle" .Form.ProfessionalTitle "hint" "professionalTitleHint" "classes" "govuk-input--width-20") }} -
- {{ end }} + + {{ if .App.IsTrustCorporation }} +
+ + {{ tr .App "authorisedSignatory" }} + -

- {{ tr .App "bySigningIUnderstandAndConfirmAllOfTheFollowing" }} -

+ {{ template "input" (input . "first-names" "firstNames" .Form.FirstNames "classes" "govuk-input--width-20" "hint" "firstNamesHint") }} + {{ template "input" (input . "last-name" "lastName" .Form.LastName "classes" "govuk-input--width-20") }} + {{ template "input" (input . "professional-title" "professionalTitle" .Form.ProfessionalTitle "hint" "professionalTitleHint" "classes" "govuk-input--width-20") }} +
+ {{ end }} -
    - {{ if .App.IsTrustCorporation }} - {{ trHtml .App "signAsTrustCorporationBullets" }} - {{ else }} - {{ trHtml .App "signAsAttorneyBullets" }} - {{ end }} -
  • - {{ if .LpaCanBeUsedWhenHasCapacity }} - {{ if .App.IsTrustCorporation }} - {{ tr .App "signAsTrustCorporationWhenRegisteredBullet" }} - {{ else }} - {{ tr .App "signAsAttorneyWhenRegisteredBullet" }} - {{ end }} - {{ else }} - {{ if .App.IsTrustCorporation }} - {{ tr .App "signAsTrustCorporationWhenCapacityLostBullet" }} - {{ else }} - {{ tr .App "signAsAttorneyWhenCapacityLostBullet" }} - {{ end }} - {{ end }} -
  • -
- - {{ if .IsReplacement }} - {{ if .App.IsTrustCorporation }} - {{ trFormatHtml .App "asReplacementTrustCorporationAlsoConfirmThat" "Name" .TrustCorporation.Name }} - {{ else }} - {{ trHtml .App "asReplacementAttorneyAlsoConfirmThat" }} - {{ end }} - {{ end }} +

+ {{ tr .App "bySigningIUnderstandAndConfirmAllOfTheFollowing" }} +

-
-
- {{ tr .App "yourSignature" }} -
-
-
- {{ template "error-message" (errorMessage . "confirm") }} +
    + {{ if .App.IsTrustCorporation }} + {{ trHtml .App "signAsTrustCorporationBullets" }} + {{ else }} + {{ trHtml .App "signAsAttorneyBullets" }} + {{ end }} +
  • + {{ if .LpaCanBeUsedWhenHasCapacity }} + {{ if .App.IsTrustCorporation }} + {{ tr .App "signAsTrustCorporationWhenRegisteredBullet" }} + {{ else }} + {{ tr .App "signAsAttorneyWhenRegisteredBullet" }} + {{ end }} + {{ else }} + {{ if .App.IsTrustCorporation }} + {{ tr .App "signAsTrustCorporationWhenCapacityLostBullet" }} + {{ else }} + {{ tr .App "signAsAttorneyWhenCapacityLostBullet" }} + {{ end }} + {{ end }} +
  • +
-
-
- - + {{ end }} + +
+
+ {{ tr .App "yourSignature" }} +
+
+
+
+ {{ template "error-message" (errorMessage . "confirm") }} + +
+
+ + +
+
+
+
+
-
-
-
-
-
- - {{ tr .App "iDoNotWantToBeAttorney" }} +
+ + {{ tr .App "iDoNotWantToBeAttorney" }} +
+ + {{ template "csrf-field" . }} +
- - {{ template "csrf-field" . }} -
-
{{ end }} diff --git a/web/template/attorney/would_like_second_signatory.gohtml b/web/template/attorney/would_like_second_signatory.gohtml index 0603f1369b..8e7bcbcfb2 100644 --- a/web/template/attorney/would_like_second_signatory.gohtml +++ b/web/template/attorney/would_like_second_signatory.gohtml @@ -3,27 +3,18 @@ {{ define "pageTitle" }}{{ tr .App "wouldYouLikeToAddSecondSignatory" }}{{ end }} {{ define "main" }} -
-
-
-
-
- -

{{ tr .App "wouldYouLikeToAddSecondSignatory" }}

-
+
+
+ + {{ template "radios-fieldset" (fieldset . .Form.FieldName .Form.YesNo.String + (legendHeading "wouldYouLikeToAddSecondSignatory" "govuk-fieldset__legend--xl") + (item .Form.Options.Yes.String "yesByddwn") + (item .Form.Options.No.String "noNaFyddwn") + ) }} - {{ template "error-message" (errorMessage . .Form.FieldName) }} - - {{ template "radios" (items . .Form.FieldName .Form.YesNo.String - (item .Form.Options.Yes.String "yesByddwn") - (item .Form.Options.No.String "noNaFyddwn") - ) }} -
+ {{ template "continue-button" . }} + {{ template "csrf-field" . }} +
- - {{ template "continue-button" . }} - {{ template "csrf-field" . }} -
-
{{ end }} diff --git a/web/template/certificateprovider/provide_certificate.gohtml b/web/template/certificateprovider/provide_certificate.gohtml index e96f876bf6..6d9ab482d7 100644 --- a/web/template/certificateprovider/provide_certificate.gohtml +++ b/web/template/certificateprovider/provide_certificate.gohtml @@ -3,44 +3,47 @@ {{ define "pageTitle" }}{{ tr .App "provideTheCertificateForThisLpa" }}{{ end }} {{ define "main" }} -
-
-

{{ tr .App "provideTheCertificateForThisLpa" }}

- -

{{ tr .App "yourStatementAsCertificateProvider" }}

- - {{ trHtml .App "provideTheCertificateForThisLpaContent" }} - -
-
-
- {{ tr .App "yourSignature" }} -
-
-
- {{ template "error-message" (errorMessage . "agree-to-statement") }} - -
-
- - +
+
+

{{ tr .App "provideTheCertificateForThisLpa" }}

+ +

{{ tr .App "yourStatementAsCertificateProvider" }}

+ + {{ trHtml .App "provideTheCertificateForThisLpaContent" }} + + +
+
+ {{ tr .App "yourSignature" }} +
+
+ {{ $hasError := .Errors.Has "agree-to-statement" }} +
+
+ {{ template "error-message" (errorMessage . "agree-to-statement") }} + +
+
+ + +
+
+
+ +

{{ tr .App "whenYouTickTheBoxToConfirmAndSign" }}

+
+
-
-

{{ tr .App "whenYouTickTheBoxToConfirmAndSign" }}

-
-
-
+
+ + +
-
- - + {{ template "csrf-field" . }} +
- - {{ template "csrf-field" . }} -
-
{{ end }} diff --git a/web/template/certificateprovider/what_is_your_home_address.gohtml b/web/template/certificateprovider/what_is_your_home_address.gohtml index 2ce280df3e..47f58bce41 100644 --- a/web/template/certificateprovider/what_is_your_home_address.gohtml +++ b/web/template/certificateprovider/what_is_your_home_address.gohtml @@ -34,7 +34,7 @@
-
-
{{ end }} diff --git a/web/template/donor/upload_evidence.gohtml b/web/template/donor/upload_evidence.gohtml index 9610536995..edb829b86a 100644 --- a/web/template/donor/upload_evidence.gohtml +++ b/web/template/donor/upload_evidence.gohtml @@ -90,7 +90,7 @@
- + {{ template "error-message" (errorMessage . "upload") }} diff --git a/web/template/donor/what_you_can_do_now.gohtml b/web/template/donor/what_you_can_do_now.gohtml index 7e25e141ab..f941c7a8ee 100644 --- a/web/template/donor/what_you_can_do_now.gohtml +++ b/web/template/donor/what_you_can_do_now.gohtml @@ -19,29 +19,22 @@ {{ template "warning" (content .App "onceYouSelectThisOptionYouCannotChangeYourMindWarning") }}
-
-
- {{ tr .App "whatWouldYouLikeToDo" }} - - {{ template "error-message" (errorMessage . "do-next") }} - - {{ if .Form.CanHaveVoucher }} - {{ template "radios" (items . "do-next" "" - (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) - (item .Form.Options.SelectNewVoucher.String .NewVoucherLabel) - (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") - (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") - ) }} - {{ else }} - {{ template "radios" (items . "do-next" "" - (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) - (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") - (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") - ) }} - {{ end }} - -
-
+ {{ if .Form.CanHaveVoucher }} + {{ template "radios-fieldset" (fieldset . "do-next" "" + (legend "whatWouldYouLikeToDo" "govuk-fieldset__legend--m") + (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) + (item .Form.Options.SelectNewVoucher.String .NewVoucherLabel) + (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") + (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") + ) }} + {{ else }} + {{ template "radios-fieldset" (fieldset . "do-next" "" + (legend "whatWouldYouLikeToDo" "govuk-fieldset__legend--m") + (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) + (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") + (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") + ) }} + {{ end }}

{{ tr .App "ifYouNeedHelpWithGOLContactTheirTeam" }}

diff --git a/web/template/donor/what_you_can_do_now_expired.gohtml b/web/template/donor/what_you_can_do_now_expired.gohtml index 9bcfe2b9fe..20088d930a 100644 --- a/web/template/donor/what_you_can_do_now_expired.gohtml +++ b/web/template/donor/what_you_can_do_now_expired.gohtml @@ -23,28 +23,22 @@ {{ template "warning" (content .App "onceYouSelectThisOptionYouCannotChangeYourMindWarning") }} -
-
- {{ tr .App "whatWouldYouLikeToDo" }} - - {{ template "error-message" (errorMessage . "do-next") }} - - {{ if .Form.CanHaveVoucher }} - {{ template "radios" (items . "do-next" "" - (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) - (item .Form.Options.SelectNewVoucher.String .NewVoucherLabel) - (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") - (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") - ) }} - {{ else }} - {{ template "radios" (items . "do-next" "" - (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) - (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") - (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") - ) }} - {{ end }} -
-
+ {{ if .Form.CanHaveVoucher }} + {{ template "radios-fieldset" (fieldset . "do-next" "" + (legend "whatWouldYouLikeToDo" "govuk-fieldset__legend--m") + (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) + (item .Form.Options.SelectNewVoucher.String .NewVoucherLabel) + (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") + (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") + ) }} + {{ else }} + {{ template "radios-fieldset" (fieldset . "do-next" "" + (legend "whatWouldYouLikeToDo" "govuk-fieldset__legend--m") + (item .Form.Options.ProveOwnIdentity.String .ProveOwnIdentityLabel) + (item .Form.Options.WithdrawLPA.String "iNoLongerWantToMakeThisLPA" "hint" "iUnderstandIWillNotGetRefundHint" "orDivider" "1") + (item .Form.Options.ApplyToCOP.String "iWillApplyToCOPToRegister" "hint" "iUnderstandICannotChangeMyMind") + ) }} + {{ end }}

{{ tr .App "ifYouNeedHelpWithGOLContactTheirTeam" }}

diff --git a/web/template/donor/when_can_the_lpa_be_used.gohtml b/web/template/donor/when_can_the_lpa_be_used.gohtml index b5ab663158..b7666227e0 100644 --- a/web/template/donor/when_can_the_lpa_be_used.gohtml +++ b/web/template/donor/when_can_the_lpa_be_used.gohtml @@ -1,33 +1,26 @@ {{ template "page" . }} -{{ define "pageTitle" }}{{ tr .App "whenYourAttorneysCanUseYourLpa" }}{{ end }} +{{ define "pageTitle" }} + {{ tr .App "whenYourAttorneysCanUseYourLpa" }} +{{ end }} {{ define "main" }} -
-
-

{{ tr .App "whenYourAttorneysCanUseYourLpa" }}

- - {{ trHtml .App "whenYourAttorneysCanUseYourLpaContent" }} +
+
+

{{ tr .App "whenYourAttorneysCanUseYourLpa" }}

- -
-
- - {{ trFormatCount .App "whenDoYouWantAttorneysToUse" .Donor.Attorneys.Len }} - + {{ trHtml .App "whenYourAttorneysCanUseYourLpaContent" }} - {{ template "error-message" (errorMessage . "when") }} + + {{ template "radios-fieldset" (fieldset . "when" .Form.When.String + (legend (trFormatCount .App "whenDoYouWantAttorneysToUse" .Donor.Attorneys.Len) "govuk-fieldset__legend--l") + (item .Options.HasCapacity.String .Options.HasCapacity.String) + (item .Options.CapacityLost.String .Options.CapacityLost.String) + ) }} - {{ template "radios" (items . "when" .Form.When.String - (item .Options.HasCapacity.String .Options.HasCapacity.String) - (item .Options.CapacityLost.String .Options.CapacityLost.String) - ) }} -
+ {{ template "buttons" (button .App "saveAndContinue") }} + {{ template "csrf-field" . }} +
- - {{ template "buttons" (button .App "saveAndContinue") }} - {{ template "csrf-field" . }} -
-
{{ end }} diff --git a/web/template/donor/which_fee_type_are_you_applying_for.gohtml b/web/template/donor/which_fee_type_are_you_applying_for.gohtml index dab9373cb3..d0c3d3bcf9 100644 --- a/web/template/donor/which_fee_type_are_you_applying_for.gohtml +++ b/web/template/donor/which_fee_type_are_you_applying_for.gohtml @@ -6,21 +6,13 @@
-
- -

{{ tr .App "whatWouldYouLikeToApplyFor" }}

-
-
- {{ template "error-message" (errorMessage . "fee-type") }} - - {{ template "radios" (items . "fee-type" "" - (item .Options.NoFee.String "noFeeAnExemption") - (item .Options.HalfFee.String "halfFeeARemission") - (item .Options.RepeatApplicationFee.String "repeatApplicationDiscount") - (item .Options.HardshipFee.String "hardshipFeeWaiver") - ) }} -
-
+ {{ template "radios-fieldset" (fieldset . "fee-type" "" + (legendHeading "whatWouldYouLikeToApplyFor" "govuk-fieldset__legend--xl") + (item .Options.NoFee.String "noFeeAnExemption") + (item .Options.HalfFee.String "halfFeeARemission") + (item .Options.RepeatApplicationFee.String "repeatApplicationDiscount") + (item .Options.HardshipFee.String "hardshipFeeWaiver") + ) }} {{ template "buttons" (button .App "saveAndContinue") }} {{ template "csrf-field" . }} diff --git a/web/template/donor/your_address.gohtml b/web/template/donor/your_address.gohtml index d470133946..e577e33565 100644 --- a/web/template/donor/your_address.gohtml +++ b/web/template/donor/your_address.gohtml @@ -39,7 +39,7 @@
-