Show district branding on root with correct slug
This commit is contained in:
parent
c5f6db0b73
commit
c435feeebc
5 changed files with 48 additions and 9 deletions
24
rmo/root.go
24
rmo/root.go
|
|
@ -5,7 +5,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
"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/Gleipnir-Technology/nidus-sync/html"
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -16,7 +19,8 @@ type ContentPrivacy struct {
|
||||||
URLReport string
|
URLReport string
|
||||||
}
|
}
|
||||||
type ContentRoot struct {
|
type ContentRoot struct {
|
||||||
URL ContentURL
|
District *ContentDistrict
|
||||||
|
URL ContentURL
|
||||||
}
|
}
|
||||||
type ContentURL struct {
|
type ContentURL struct {
|
||||||
Nuisance string
|
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) {
|
func getRobots(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprint(w, "User-agent: *\n")
|
fmt.Fprint(w, "User-agent: *\n")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ func Router() chi.Router {
|
||||||
r.Get("/nuisance", getNuisance)
|
r.Get("/nuisance", getNuisance)
|
||||||
r.Post("/nuisance", postNuisance)
|
r.Post("/nuisance", postNuisance)
|
||||||
r.Get("/submit-complete", getSubmitComplete)
|
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", renderMock(mockNuisanceT))
|
||||||
//r.Get("/district/{slug}/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT))
|
//r.Get("/district/{slug}/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT))
|
||||||
//r.Get("/district/{slug}/status", renderMock(mockStatusT))
|
//r.Get("/district/{slug}/status", renderMock(mockStatusT))
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,6 @@
|
||||||
transform: translateY(-5px);
|
transform: translateY(-5px);
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
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 {
|
.quick-report-mobile {
|
||||||
background-color: #ff9800;
|
background-color: #ff9800;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,28 @@
|
||||||
{{define "content"}}
|
{{define "content"}}
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
<main>
|
<main>
|
||||||
|
{{ if eq .District nil }}
|
||||||
<!-- Introduction Section -->
|
<!-- Introduction Section -->
|
||||||
<section class="py-2 bg-primary text-white">
|
<section class="py-2 bg-primary text-white">
|
||||||
<div class="banner-container d-flex justify-content-center">
|
<div class="banner-container d-flex justify-content-center">
|
||||||
<img class="banner" src="/static/img/rmo/banner.jpg"/>
|
<img class="banner" src="/static/img/rmo/banner.jpg"/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
{{ else }}
|
||||||
|
<!-- Introduction Section -->
|
||||||
|
<section class="py-5 bg-primary text-white">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<h2 class="text-center mb-4">Report a Mosquito Problem</h2>
|
||||||
|
<p class="lead text-center">Submit a report to help reduce mosquito activity in your neighborhood.</p>
|
||||||
|
<p class="lead text-center">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.</p>
|
||||||
|
<img class="district-logo" src="{{.District.URLLogo}}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<!-- Services Section -->
|
<!-- Services Section -->
|
||||||
<section class="py-5">
|
<section class="py-5">
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,13 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.district-logo {
|
||||||
|
display:block;
|
||||||
|
margin-left:auto;
|
||||||
|
margin-right:auto;
|
||||||
|
max-height: 88px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
.service-card {
|
.service-card {
|
||||||
transition: transform 0.3s;
|
transition: transform 0.3s;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue