diff --git a/internal/templatefn/fn.go b/internal/templatefn/fn.go index 87659e4a70..2b15f31ddf 100644 --- a/internal/templatefn/fn.go +++ b/internal/templatefn/fn.go @@ -391,14 +391,16 @@ type notificationBannerData struct { App page.AppData Title string Content template.HTML + Heading bool Success bool } -func notificationBanner(app page.AppData, title string, content template.HTML, success bool) notificationBannerData { +func notificationBanner(app page.AppData, title string, content template.HTML, options ...string) notificationBannerData { return notificationBannerData{ App: app, Title: title, Content: content, - Success: success, + Heading: slices.Contains(options, "heading"), + Success: slices.Contains(options, "success"), } } diff --git a/internal/templatefn/fn_test.go b/internal/templatefn/fn_test.go index f5a3e73131..16f957cc82 100644 --- a/internal/templatefn/fn_test.go +++ b/internal/templatefn/fn_test.go @@ -452,5 +452,12 @@ func TestNotificationBanner(t *testing.T) { Title: "title", Content: "content", Success: true, - }, notificationBanner(app, "title", "content", true)) + Heading: true, + }, notificationBanner(app, "title", "content", "heading", "success")) + + assert.Equal(t, notificationBannerData{ + App: app, + Title: "title", + Content: "content", + }, notificationBanner(app, "title", "content")) } diff --git a/web/template/attorney/code_of_conduct.gohtml b/web/template/attorney/code_of_conduct.gohtml index 080044b31c..c6bdf770d5 100644 --- a/web/template/attorney/code_of_conduct.gohtml +++ b/web/template/attorney/code_of_conduct.gohtml @@ -7,31 +7,23 @@ {{ define "main" }}
- + {{ $notificationContent := "" }} + {{ if .App.IsReplacementAttorney }} + {{ if .App.IsTrustCorporation }} + {{ $notificationContent = "weHaveIdentifiedTheTrustCorporationsReplacementAttorneyReferenceNumber" }} + {{ else }} + {{ $notificationContent = "weHaveIdentifiedYourReplacementAttorneyReferenceNumber" }} + {{ end }} + {{ else }} + {{ if .App.IsTrustCorporation }} + {{ $notificationContent = "weHaveIdentifiedTheTrustCorporationsAttorneyReferenceNumber" }} + {{ else }} + {{ $notificationContent = "weHaveIdentifiedYourAttorneyReferenceNumber" }} + {{ end }} + {{ end }} + {{ template "notification-banner" (notificationBanner .App "success" (trHtml .App $notificationContent) "success" "heading") }} +

{{ tr .App "actingAsAttorney" }}

{{ $content := "" }} diff --git a/web/template/certificateprovider/who_is_eligible.gohtml b/web/template/certificateprovider/who_is_eligible.gohtml index 65626668b8..2e1a3dca33 100644 --- a/web/template/certificateprovider/who_is_eligible.gohtml +++ b/web/template/certificateprovider/who_is_eligible.gohtml @@ -5,20 +5,7 @@ {{ define "main" }}
- + {{ template "notification-banner" (notificationBanner .App "success" (trHtml .App "weHaveIdentifiedYourCertificateProviderReferenceNumber") "success" "heading") }}

{{ tr .App "whoIsEligibleToBeCertificateProvider" }} diff --git a/web/template/donor/lpa_details_saved.gohtml b/web/template/donor/lpa_details_saved.gohtml index f2d4b0b7b8..14364b9071 100644 --- a/web/template/donor/lpa_details_saved.gohtml +++ b/web/template/donor/lpa_details_saved.gohtml @@ -5,33 +5,22 @@ {{ define "main" }}
+ {{ $notificationContent := "" }} + {{ if .IsFirstCheck }} + {{ if .Donor.CertificateProvider.CarryOutBy.IsPaper }} + {{ $notificationContent = "lpaDetailsSavedContentOnFirstSubmissionCPCarryingOutRolePaper" }} + {{ else }} + {{ $notificationContent = "lpaDetailsSavedContentOnFirstSubmissionCPCarryingOutRoleOnline" }} + {{ end }} + {{ else }} + {{ if .Donor.CertificateProvider.CarryOutBy.IsPaper }} + {{ $notificationContent = "lpaDetailsSavedContentOnSubsequentSubmissionCPCarryingOutRolePaper" }} + {{ else }} + {{ $notificationContent = "lpaDetailsSavedContentOnSubsequentSubmissionCPCarryingOutRoleOnline" }} + {{ end }} + {{ end }} - + {{ template "notification-banner" (notificationBanner .App "lpaDetailsSaved" (trFormatHtml .App $notificationContent "CertificateProviderFullName" .Donor.CertificateProvider.FullName) "success") }} {{ if .Donor.Tasks.PayForLpa.IsCompleted }}
diff --git a/web/template/donor/need_help_signing_confirmation.gohtml b/web/template/donor/need_help_signing_confirmation.gohtml index 234356a361..daa304232b 100644 --- a/web/template/donor/need_help_signing_confirmation.gohtml +++ b/web/template/donor/need_help_signing_confirmation.gohtml @@ -5,16 +5,7 @@ {{ define "main" }}
-
-
-

{{ tr .App "informationSaved" }}

-
-
-

- {{ tr .App "weKnowYouWillNeedHelpSigning" }} -

-
-
+ {{ template "notification-banner" (notificationBanner .App "informationSaved" (trHtml .App "weKnowYouWillNeedHelpSigning") "success") }} {{ trHtml .App "weKnowYouWillNeedHelpSigningContent" }} diff --git a/web/template/donor/we_have_updated_your_details.gohtml b/web/template/donor/we_have_updated_your_details.gohtml index 7c2eeec4b3..0f3bbb6165 100644 --- a/web/template/donor/we_have_updated_your_details.gohtml +++ b/web/template/donor/we_have_updated_your_details.gohtml @@ -7,16 +7,7 @@
- + {{ template "notification-banner" (notificationBanner .App (trFormat .App "detailUpdated" "Detail" (tr .App (.App.Query.Get "detail"))) (trFormatHtml .App "weHaveUpdatedYourDetail" "Detail" $detail) "success") }}

{{ trFormat .App "yourDetailHasBeenUpdated" "Detail" $detail }}

diff --git a/web/template/layout/notification-banner.gohtml b/web/template/layout/notification-banner.gohtml index 70dba0ff12..4d0854288d 100644 --- a/web/template/layout/notification-banner.gohtml +++ b/web/template/layout/notification-banner.gohtml @@ -6,7 +6,7 @@

-

+

{{ .Content }}

diff --git a/web/template/lpa_deleted.gohtml b/web/template/lpa_deleted.gohtml index 2b983c7d2c..96b01cb81d 100644 --- a/web/template/lpa_deleted.gohtml +++ b/web/template/lpa_deleted.gohtml @@ -5,14 +5,7 @@ {{ define "main" }}
-
-
-

{{ tr .App "lpaDeleted" }}

-
-
-

{{ trFormatHtml .App "lpaNumberHasBeenDeleted" "UID" (.App.Query.Get "uid") }}

-
-
+ {{ template "notification-banner" (notificationBanner .App "lpaDeleted" (trFormatHtml .App "lpaNumberHasBeenDeleted" "UID" (.App.Query.Get "uid")) "success") }} {{ tr .App "returnToDashboard" }}
diff --git a/web/template/lpa_withdrawn.gohtml b/web/template/lpa_withdrawn.gohtml index 30f1a87982..73a76d5afa 100644 --- a/web/template/lpa_withdrawn.gohtml +++ b/web/template/lpa_withdrawn.gohtml @@ -5,14 +5,7 @@ {{ define "main" }}
-
-
-

{{ tr .App "lpaWithdrawn" }}

-
-
-

{{ trFormatHtml .App "youHaveWithdrawnLpaNumber" "UID" (.App.Query.Get "uid") }}

-
-
+ {{ template "notification-banner" (notificationBanner .App "lpaWithdrawn" (trFormatHtml .App "youHaveWithdrawnLpaNumber" "UID" (.App.Query.Get "uid")) "success") }}

{{ tr .App "opgWillNowContactAnyoneWhoHasAlreadyBeenContacted" }}

diff --git a/web/template/supporter/dashboard.gohtml b/web/template/supporter/dashboard.gohtml index 99eb1c3c8b..260d183f57 100644 --- a/web/template/supporter/dashboard.gohtml +++ b/web/template/supporter/dashboard.gohtml @@ -6,21 +6,8 @@
{{ if .App.Query.Has "nameUpdated" }} - - {{ end}} + {{ template "notification-banner" (notificationBanner .App "nameUpdated" (trFormatHtml .App "yourNameHasBeenUpdatedToNewName" "NewName" (.App.Query.Get "nameUpdated")) "success") }} + {{ end }}

{{ template "pageTitle" . }}

diff --git a/web/template/supporter/manage_team_members.gohtml b/web/template/supporter/manage_team_members.gohtml index 2b1d8d1af0..34399a9dad 100644 --- a/web/template/supporter/manage_team_members.gohtml +++ b/web/template/supporter/manage_team_members.gohtml @@ -6,66 +6,27 @@
{{ if .App.Query.Has "inviteSent" }} - + {{ template "notification-banner" (notificationBanner .App "invitationSent" (trFormatHtml .App "weHaveSentInvite" "Email" (.App.Query.Get "inviteSent")) "success") }} {{ end}} {{ if .App.Query.Has "nameUpdated" }} - + {{ $nameUpdatedContent := "teamMembersNameUpdatedToNewName" }} + {{ if .App.Query.Has "selfUpdated" }} + {{ $nameUpdatedContent = "yourNameHasBeenUpdatedToNewName" }} + {{ end }} + + {{ template "notification-banner" (notificationBanner .App "nameUpdated" (trFormatHtml .App $nameUpdatedContent "NewName" (.App.Query.Get "nameUpdated")) "success") }} {{ end}} {{ if and (.App.Query.Has "statusUpdated") (.App.Query.Has "statusEmail") }} - + {{ $statusUpdatedTitle := "accessUpdated" }} + {{ $statusUpdatedContent := "emailCanNowAccessOrganisation" }} + {{ if eq (.App.Query.Get "statusUpdated") "suspended" }} + {{ $statusUpdatedTitle = "teamMemberSuspended" }} + {{ $statusUpdatedContent = "emailHasBeenSuspended" }} + {{ end }} + + {{ template "notification-banner" (notificationBanner .App $statusUpdatedTitle (trFormatHtml .App $statusUpdatedContent "Email" (.App.Query.Get "statusEmail"))) }} {{ end}}

{{ tr .App "manageOrganisation" }}

diff --git a/web/template/supporter/organisation_created.gohtml b/web/template/supporter/organisation_created.gohtml index 2181efe736..129f66e2eb 100644 --- a/web/template/supporter/organisation_created.gohtml +++ b/web/template/supporter/organisation_created.gohtml @@ -5,20 +5,7 @@ {{ define "main" }}
- + {{ template "notification-banner" (notificationBanner .App "organisationCreated" (trFormatHtml .App "yourOrganisationHasBeenCreated" "Name" .Organisation.Name) "success") }} {{ trHtml .App "organisationCreatedContent" }} diff --git a/web/template/supporter/organisation_deleted.gohtml b/web/template/supporter/organisation_deleted.gohtml index 1170964510..4ace6bdb99 100644 --- a/web/template/supporter/organisation_deleted.gohtml +++ b/web/template/supporter/organisation_deleted.gohtml @@ -5,18 +5,7 @@ {{ define "main" }}
- + {{ template "notification-banner" (notificationBanner .App "organisationDeleted" (trFormatHtml .App "theOrganisationHasBeenDeleted" "OrganisationName" (.App.Query.Get "organisationName"))) }}
{{ end }} diff --git a/web/template/supporter/organisation_details.gohtml b/web/template/supporter/organisation_details.gohtml index 5ddaf57e97..7e55a5b671 100644 --- a/web/template/supporter/organisation_details.gohtml +++ b/web/template/supporter/organisation_details.gohtml @@ -6,16 +6,7 @@
{{ if eq (.App.Query.Get "updated") "name" }} - + {{ template "notification-banner" (notificationBanner .App "organisationNameSaved" (trHtml .App "yourOrganisationNameHasBeenSaved") "success") }} {{ end }}

{{ tr .App "manageOrganisation" }}

diff --git a/web/template/supporter/suspended.gohtml b/web/template/supporter/suspended.gohtml index aa149b649a..2027fd2bc8 100644 --- a/web/template/supporter/suspended.gohtml +++ b/web/template/supporter/suspended.gohtml @@ -5,18 +5,7 @@ {{ define "main" }}
- + {{ template "notification-banner" (notificationBanner .App "accessSuspended" (trFormatHtml .App "accessSuspendedContent" "OrganisationName" .OrganisationName)) }}
{{ end }} diff --git a/web/template/supporter/view_lpa.gohtml b/web/template/supporter/view_lpa.gohtml index 1f1ec5a918..3e49648495 100644 --- a/web/template/supporter/view_lpa.gohtml +++ b/web/template/supporter/view_lpa.gohtml @@ -6,11 +6,11 @@
{{ if .App.Query.Has "inviteSentTo" }} - {{ template "notification-banner" (notificationBanner .App "inviteSent" (trFormatHtml .App "youSentAnInviteTo" "Email" (.App.Query.Get "inviteSentTo")) true) }} + {{ template "notification-banner" (notificationBanner .App "inviteSent" (trFormatHtml .App "youSentAnInviteTo" "Email" (.App.Query.Get "inviteSentTo")) "success") }} {{ end }} {{ if .App.Query.Has "inviteRecalledFor" }} - {{ template "notification-banner" (notificationBanner .App "inviteRecalled" (trFormatHtml .App "youRecalledTheInviteFor" "Email" (.App.Query.Get "inviteRecalledFor")) false) }} + {{ template "notification-banner" (notificationBanner .App "inviteRecalled" (trFormatHtml .App "youRecalledTheInviteFor" "Email" (.App.Query.Get "inviteRecalledFor"))) }} {{ end }} {{ .Donor.Donor.FullName }}