Add branded header for nuisance report
This commit is contained in:
parent
9aee938e30
commit
65c3e8ee51
4 changed files with 28 additions and 9 deletions
|
|
@ -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),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
13
public-report/template/component/header.html
Normal file
13
public-report/template/component/header.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{{define "header"}}
|
||||
<header class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<div class="d-flex align-items-center">
|
||||
<a class="navbar-brand d-flex align-items-center" href="/">
|
||||
<img src="{{.District.URLLogo}}" style="height: 48px;" alt="District logo"></img>
|
||||
</a>
|
||||
<h1 class="mb-0 ms-3">{{.District.Name}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{end}}
|
||||
|
|
@ -236,6 +236,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
</style>
|
||||
{{end}}
|
||||
{{define "content"}}
|
||||
{{if .District}}
|
||||
{{template "header" .}}
|
||||
{{end}}
|
||||
<div class="container">
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue