Skip to content

Commit

Permalink
prefer else
Browse files Browse the repository at this point in the history
  • Loading branch information
acsauk committed Mar 21, 2024
1 parent dfed08b commit 671500e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/page/app_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type AppData struct {
LoggedInSupporterID string
IsDonorPage bool
LpaType actor.LpaType
DonorName string
DonorFullName string
}

func (d AppData) Redirect(w http.ResponseWriter, r *http.Request, url string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/page/donor/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func makeLpaHandle(mux *http.ServeMux, store SessionStore, errorHandler page.Err
appData.OrganisationName = loginSession.OrganisationName
appData.IsDonorPage = true
appData.LpaType = lpa.Type
appData.DonorName = lpa.Donor.FullName()
appData.DonorFullName = lpa.Donor.FullName()
}

if err := h(appData, w, r.WithContext(page.ContextWithAppData(ctx, appData)), lpa); err != nil {
Expand Down
9 changes: 4 additions & 5 deletions web/template/layout/supporter-lpa-context.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
<div class="app-supporter-lpa-context-banner">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{{ if and (not .App.DonorName) .App.LpaType.Empty }}
{{ if and (not .App.DonorFullName) .App.LpaType.Empty }}
{{ trHtml .App "supporterLPAContextPrimer" }}
{{ end }}

{{ if .App.DonorName }}
{{ else }}
<p class="app-supporter-lpa-context-banner__content">
{{ tr .App "youAreDrafting" }} <span class="govuk-!-font-weight-bold">{{ .App.Localizer.Possessive .App.DonorName }} {{ if not .App.LpaType.Empty }}{{ tr .App .App.LpaType.String | lowerFirst }} {{ end }}</span>{{ tr .App "lpa" }}
{{ $donorNamePossessive := .App.Localizer.Possessive .App.DonorFullName }}
{{ tr .App "youAreDrafting" }} <span class="govuk-!-font-weight-bold">{{ $donorNamePossessive }} {{ if not .App.LpaType.Empty }} {{ lowerFirst (tr .App .App.LpaType.String) }} {{ end }}</span>{{ tr .App "lpa" }}
</p>
{{ end }}
</div>
Expand Down

0 comments on commit 671500e

Please sign in to comment.