rename space to district
This commit is contained in:
1 parent
94d56f9a8f
commit
8a2ac56844
7 files changed
+253
-9
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"pageswiki/internal/store"
|
||||
)
|
||||
|
||||
type RequestContext struct {
|
||||
District *store.District
|
||||
}
|
||||
|
||||
func (s *Server) BuildRequestContext(
|
||||
r *http.Request,
|
||||
) *RequestContext {
|
||||
|
||||
return &RequestContext{
|
||||
District: s.currentDistrict(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) renderWithContext(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
name string,
|
||||
data map[string]any,
|
||||
) {
|
||||
|
||||
if data == nil {
|
||||
data = map[string]any{}
|
||||
}
|
||||
|
||||
data["Context"] =
|
||||
s.BuildRequestContext(
|
||||
r,
|
||||
)
|
||||
|
||||
s.render(
|
||||
w,
|
||||
name,
|
||||
data,
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user