templating: Move actions into template
This commit is contained in:
parent
313af2b9e3
commit
202599aaeb
23 changed files with 153 additions and 105 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue