From 65c3e8ee5198d3f339b251cb41e6c63a0268379e Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 24 Jan 2026 21:29:24 +0000 Subject: [PATCH] Add branded header for nuisance report --- public-report/mock.go | 19 +++++++++++-------- public-report/page.go | 2 +- public-report/template/component/header.html | 13 +++++++++++++ public-report/template/mock/nuisance.html | 3 +++ 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 public-report/template/component/header.html diff --git a/public-report/mock.go b/public-report/mock.go index d7b10ce0..2d7b3469 100644 --- a/public-report/mock.go +++ b/public-report/mock.go @@ -36,22 +36,25 @@ type ContentMock struct { func addMockRoutes(r chi.Router) { r.Get("/", renderMock(mockRootT)) r.Get("/district/{slug}", renderMock(mockDistrictRootT)) + r.Get("/district/{slug}/nuisance", renderMock(mockNuisanceT)) + r.Get("/district/{slug}/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT)) + r.Get("/district/{slug}/status", renderMock(mockStatusT)) r.Get("/nuisance", renderMock(mockNuisanceT)) r.Get("/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT)) r.Get("/status", renderMock(mockStatusT)) } -func makeContentURL() ContentURL { +func makeContentURL(slug string) ContentURL { return ContentURL{ - Nuisance: makeURLMock("nuisance"), - NuisanceSubmitComplete: makeURLMock("nuisance-submit-complete"), - Status: makeURLMock("status"), + Nuisance: makeURLMock(slug, "nuisance"), + NuisanceSubmitComplete: makeURLMock(slug, "nuisance-submit-complete"), + Status: makeURLMock(slug, "status"), Tegola: config.MakeURLTegola("/"), } } -func makeURLMock(p string) string { - return config.MakeURLReport("/mock/%s", p) +func makeURLMock(slug, p string) string { + return config.MakeURLReport("/mock/district/%s/%s", slug, p) } func renderMock(t *htmlpage.BuiltTemplate) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { @@ -64,12 +67,12 @@ func renderMock(t *htmlpage.BuiltTemplate) func(http.ResponseWriter, *http.Reque t, ContentMock{ District: ContentDistrict{ - Name: "Delta MCD", + Name: "Delta MVCD", URLLogo: config.MakeURLNidus("/api/district/%s/logo", slug), }, MapboxToken: config.MapboxToken, ReportID: "abcd-1234-5678", - URL: makeContentURL(), + URL: makeContentURL(slug), }, ) } diff --git a/public-report/page.go b/public-report/page.go index 0b166703..2785e7e6 100644 --- a/public-report/page.go +++ b/public-report/page.go @@ -10,7 +10,7 @@ import ( //go:embed template/* var embeddedFiles embed.FS -var components = [...]string{"footer", "photo-upload", "photo-upload-header"} +var components = [...]string{"footer", "header", "photo-upload", "photo-upload-header"} var svgs = [...]string{"check-report", "mosquito", "pond"} func buildTemplate(files ...string) *htmlpage.BuiltTemplate { diff --git a/public-report/template/component/header.html b/public-report/template/component/header.html new file mode 100644 index 00000000..453a2aa3 --- /dev/null +++ b/public-report/template/component/header.html @@ -0,0 +1,13 @@ +{{define "header"}} + + +{{end}} diff --git a/public-report/template/mock/nuisance.html b/public-report/template/mock/nuisance.html index ed22a714..0883a3f7 100644 --- a/public-report/template/mock/nuisance.html +++ b/public-report/template/mock/nuisance.html @@ -236,6 +236,9 @@ document.addEventListener('DOMContentLoaded', function() { {{end}} {{define "content"}} +{{if .District}} + {{template "header" .}} +{{end}}