footer: Add a semi-flexible template system

This commit is contained in:
Tom Wiesing 2023-01-06 22:52:47 +01:00
parent bda763725e
commit 021fc3cc7e
No known key found for this signature in database
26 changed files with 239 additions and 208 deletions

View file

@ -3,7 +3,6 @@ package admin
import (
"context"
"errors"
"html/template"
"net/http"
_ "embed"
@ -27,12 +26,11 @@ type userContext struct {
custom.BaseContext
httpx.FormContext
CSRF template.HTML
Users []*auth.AuthUser
}
func (admin *Admin) users(r *http.Request) (uc userContext, err error) {
admin.Dependencies.Custom.Update(&uc)
admin.Dependencies.Custom.Update(&uc, r)
uc.CSRF = csrf.TemplateField(r)
uc.Users, err = admin.Dependencies.Auth.Users(r.Context())