custom: Add new footer template and context
This commit is contained in:
parent
009d649ea6
commit
bda763725e
18 changed files with 197 additions and 33 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control/static"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control/static/custom"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
|
||||
)
|
||||
|
||||
|
|
@ -18,9 +19,19 @@ var userTemplate = static.AssetsUser.MustParseShared(
|
|||
userHTMLStr,
|
||||
)
|
||||
|
||||
type routeUserContext struct {
|
||||
custom.BaseContext
|
||||
*auth.AuthUser
|
||||
}
|
||||
|
||||
func (panel *UserPanel) routeUser(ctx context.Context) http.Handler {
|
||||
return &httpx.HTMLHandler[*auth.AuthUser]{
|
||||
Handler: panel.Dependencies.Auth.UserOf,
|
||||
userTemplate := panel.Dependencies.Custom.Template(userTemplate)
|
||||
return &httpx.HTMLHandler[routeUserContext]{
|
||||
Handler: func(r *http.Request) (ruc routeUserContext, err error) {
|
||||
panel.Dependencies.Custom.Update(&ruc)
|
||||
ruc.AuthUser, err = panel.Dependencies.Auth.UserOf(r)
|
||||
return routeUserContext{}, err
|
||||
},
|
||||
Template: userTemplate,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue