Add basic layout test

This is testing a new way to do the main site layout that I think will
be a better fit for where I want the UI to go with a collapsable
interface.
This commit is contained in:
Eli Ribble 2026-01-28 17:15:42 +00:00
parent bdb3c80ad7
commit 082fdeebdd
No known key found for this signature in database
7 changed files with 294 additions and 10 deletions

View file

@ -22,12 +22,13 @@ import (
// Authenticated pages
var (
cellT = buildTemplate("cell", "authenticated")
dashboardT = buildTemplate("dashboard", "authenticated")
districtT = buildTemplate("district", "base")
settingsT = buildTemplate("settings", "authenticated")
sourceT = buildTemplate("source", "authenticated")
trapT = buildTemplate("trap", "authenticated")
cellT = buildTemplate("cell", "authenticated")
dashboardT = buildTemplate("dashboard", "authenticated")
districtT = buildTemplate("district", "base")
layoutTestT = buildTemplate("layout-test", "authenticated")
settingsT = buildTemplate("settings", "authenticated")
sourceT = buildTemplate("source", "authenticated")
trapT = buildTemplate("trap", "authenticated")
)
type Config struct {
@ -71,6 +72,9 @@ type ContextDashboard struct {
User User
}
type ContentLayoutTest struct {
User User
}
type ContextDistrict struct {
MapboxToken string
}
@ -96,6 +100,15 @@ func getDistrict(w http.ResponseWriter, r *http.Request) {
htmlpage.RenderOrError(w, districtT, &context)
}
func getLayoutTest(w http.ResponseWriter, r *http.Request, u *models.User) {
userContent, err := contentForUser(r.Context(), u)
if err != nil {
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
return
}
htmlpage.RenderOrError(w, layoutTestT, &ContentLayoutTest{User: userContent})
}
func getRoot(w http.ResponseWriter, r *http.Request) {
user, err := auth.GetAuthenticatedUser(r)
if err != nil {