Slight page refactoring, text pages, tooltips

This commit is contained in:
Simon Martens
2025-02-22 00:11:25 +01:00
parent 0d79239fd8
commit 29576ec7a0
47 changed files with 2079 additions and 295 deletions

View File

@@ -7,30 +7,8 @@ import (
)
type IPage interface {
Up(app core.App) error
Down(app core.App) error
Up(app core.App, engine *templating.Engine) error
Down(app core.App, engine *templating.Engine) error
// TODO: pass the cache here
Setup(router *router.Router[*core.RequestEvent], app core.App, engine *templating.Engine) error
}
type Page struct {
// WARNING: this is not thread safe, just set this once in setup
Name string
Layout string
Template string
}
func (p *Page) Up(app core.App) error {
return nil
}
func (p *Page) Down(app core.App) error {
return nil
}
func (p *Page) Setup(router *router.Router[*core.RequestEvent], app core.App, engine *templating.Engine) error {
router.GET(p.Name, func(e *core.RequestEvent) error {
return engine.Response200(e, p.Template, nil, p.Layout)
})
return nil
}