From 5b25ab9ad81ab30fa18c9e449b2ec6da2cd717d3 Mon Sep 17 00:00:00 2001 From: Rhys Date: Tue, 2 Jul 2024 16:31:40 +0100 Subject: [PATCH 1/2] Add search service to mapper.go --- mapper/mapper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mapper/mapper.go b/mapper/mapper.go index b462aa8..1b20a7f 100644 --- a/mapper/mapper.go +++ b/mapper/mapper.go @@ -24,6 +24,7 @@ func CreateGetFeedback(req *http.Request, basePage core.Page, validationErrors [ var services = make(map[string]string) services["cmd"] = "customising data by applying filters" services["dev"] = "ONS developer" + services["search"] = "search" serviceDescription := services[req.URL.Query().Get("service")] p.Language = lang From 6b66773cd3cee19175f17bf06a82b57528649c8c Mon Sep 17 00:00:00 2001 From: Rhys Date: Tue, 2 Jul 2024 16:35:18 +0100 Subject: [PATCH 2/2] Change radio behaviour --- mapper/mapper.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mapper/mapper.go b/mapper/mapper.go index 1b20a7f..01409d2 100644 --- a/mapper/mapper.go +++ b/mapper/mapper.go @@ -70,7 +70,7 @@ func CreateGetFeedback(req *http.Request, basePage core.Page, validationErrors [ { Input: core.Input{ ID: "specific-page", - IsChecked: ff.Type == "A specific page" || ff.URL != "", + IsChecked: ff.Type == "A specific page" || (ff.URL != "" && serviceDescription == ""), Label: core.Localisation{ LocaleKey: "FeedbackASpecificPage", Plural: 1, @@ -82,7 +82,12 @@ func CreateGetFeedback(req *http.Request, basePage core.Page, validationErrors [ Autocomplete: "url", ID: "page-url-field", Name: "url", - Value: ff.URL, + Value: func() string { + if serviceDescription != "" { + return "" + } + return ff.URL + }(), Label: core.Localisation{ LocaleKey: "FeedbackWhatEnterURL", Plural: 1, @@ -108,7 +113,7 @@ func CreateGetFeedback(req *http.Request, basePage core.Page, validationErrors [ core.Radio{ Input: core.Input{ ID: "new-service", - IsChecked: ff.Type == "new-service", + IsChecked: true, Label: core.Localisation{ Text: helper.Localise("FeedbackWhatOptNewService", lang, 1, serviceDescription), },