templating: Move actions into template

This commit is contained in:
Tom Wiesing 2023-01-12 13:55:07 +01:00
parent 313af2b9e3
commit 202599aaeb
No known key found for this signature in database
23 changed files with 153 additions and 105 deletions

View file

@ -123,8 +123,10 @@ type newsContext struct {
// HandleRoute returns the handler for the requested path
func (news *News) HandleRoute(ctx context.Context, path string) (http.Handler, error) {
crumbs := []component.MenuItem{
{Title: "News", Path: "/news/"},
gaps := custom.BaseContextGaps{
Crumbs: []component.MenuItem{
{Title: "News", Path: "/news/"},
},
}
items, itemsErr := Items()
@ -134,7 +136,7 @@ func (news *News) HandleRoute(ctx context.Context, path string) (http.Handler, e
return httpx.HTMLHandler[newsContext]{
Handler: func(r *http.Request) (nc newsContext, err error) {
news.Dependencies.Custom.Update(&nc, r, crumbs)
news.Dependencies.Custom.Update(&nc, r, gaps)
nc.Items, err = items, itemsErr
return