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" }} -
- - {{ 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 }} -