Update grant page

This commit is contained in:
Tom Wiesing 2023-01-07 13:14:43 +01:00
parent 021fc3cc7e
commit 97f5ac7e1a
No known key found for this signature in database
10 changed files with 313 additions and 54 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth/policy"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control/static/custom"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/exporter"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/exporter/logger"
@ -28,6 +29,8 @@ type Admin struct {
Auth *auth.Auth
Policy *policy.Policy
Custom *custom.Custom
}
@ -108,6 +111,16 @@ func (admin *Admin) HandleRoute(ctx context.Context, route string) (handler http
Template: admin.Dependencies.Custom.Template(instanceTemplate),
})
// add a router for the grants pages
router.Handler(http.MethodGet, route+"grants/:slug", httpx.HTMLHandler[grantsContext]{
Handler: admin.getGrants,
Template: admin.Dependencies.Custom.Template(grantsTemplate),
})
router.Handler(http.MethodPost, route+"grants/", httpx.HTMLHandler[grantsContext]{
Handler: admin.postGrants,
Template: admin.Dependencies.Custom.Template(grantsTemplate),
})
// add a router for the login page
router.Handler(http.MethodPost, route+"login", admin.loginHandler(ctx))