From c435feeebc0a644d345b4b7e55467becf5e562bf Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sun, 1 Feb 2026 02:57:58 +0000 Subject: [PATCH] Show district branding on root with correct slug --- rmo/root.go | 24 +++++++++++++++++++++++- rmo/routes.go | 3 ++- rmo/template/mock/district-root.html | 7 ------- rmo/template/root.html | 16 ++++++++++++++++ scss/rmo/root.scss | 7 +++++++ 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/rmo/root.go b/rmo/root.go index 070765c8..f8b5a9f5 100644 --- a/rmo/root.go +++ b/rmo/root.go @@ -5,7 +5,10 @@ import ( "net/http" "github.com/Gleipnir-Technology/nidus-sync/config" + "github.com/Gleipnir-Technology/nidus-sync/db" + "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/Gleipnir-Technology/nidus-sync/html" + "github.com/go-chi/chi/v5" "github.com/rs/zerolog/log" ) @@ -16,7 +19,8 @@ type ContentPrivacy struct { URLReport string } type ContentRoot struct { - URL ContentURL + District *ContentDistrict + URL ContentURL } type ContentURL struct { Nuisance string @@ -62,6 +66,24 @@ func getRoot(w http.ResponseWriter, r *http.Request) { }, ) } +func getRootDistrict(w http.ResponseWriter, r *http.Request) { + slug := chi.URLParam(r, "slug") + district, err := models.Organizations.Query( + models.SelectWhere.Organizations.Slug.EQ(slug), + ).One(r.Context(), db.PGInstance.BobDB) + if err != nil { + respondError(w, "Failed to lookup organization", err, http.StatusBadRequest) + return + } + html.RenderOrError( + w, + RootT, + ContentRoot{ + District: newContentDistrict(district), + URL: makeContentURL(), + }, + ) +} func getRobots(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "User-agent: *\n") diff --git a/rmo/routes.go b/rmo/routes.go index 5c073267..247a51d6 100644 --- a/rmo/routes.go +++ b/rmo/routes.go @@ -11,7 +11,8 @@ func Router() chi.Router { r.Get("/nuisance", getNuisance) r.Post("/nuisance", postNuisance) r.Get("/submit-complete", getSubmitComplete) - //r.Get("/district/{slug}", renderMock(mockDistrictRootT)) + + r.Get("/district/{slug}", getRootDistrict) //r.Get("/district/{slug}/nuisance", renderMock(mockNuisanceT)) //r.Get("/district/{slug}/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT)) //r.Get("/district/{slug}/status", renderMock(mockStatusT)) diff --git a/rmo/template/mock/district-root.html b/rmo/template/mock/district-root.html index 9a32b37c..82cb8a91 100644 --- a/rmo/template/mock/district-root.html +++ b/rmo/template/mock/district-root.html @@ -11,13 +11,6 @@ transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); } -.district-logo { - display:block; - margin-left:auto; - margin-right:auto; - max-height: 88px; - width: auto; -} .quick-report-mobile { background-color: #ff9800; } diff --git a/rmo/template/root.html b/rmo/template/root.html index 42443681..4668acaa 100644 --- a/rmo/template/root.html +++ b/rmo/template/root.html @@ -6,12 +6,28 @@ {{define "content"}}
+ {{ if eq .District nil }}
+ {{ else }} + +
+
+
+
+

Report a Mosquito Problem

+

Submit a report to help reduce mosquito activity in your neighborhood.

+

Report Mosquitoes Online works with local mosquito control agencies to receive public reports. For this area, mosquito control services are provided by Delta Mosquito and Vector Control District.

+ +
+
+
+
+ {{ end }}
diff --git a/scss/rmo/root.scss b/scss/rmo/root.scss index d774dbbe..1bb7880e 100644 --- a/scss/rmo/root.scss +++ b/scss/rmo/root.scss @@ -11,6 +11,13 @@ height: 100%; } } +.district-logo { + display:block; + margin-left:auto; + margin-right:auto; + max-height: 88px; + width: auto; +} .service-card { transition: transform 0.3s; height: 100%;