mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 17:25:32 +00:00
added alpine ajax - started conversion of the proj
This commit is contained in:
@@ -34,9 +34,14 @@ type AlmanachPage struct {
|
||||
}
|
||||
|
||||
func (p *AlmanachPage) Setup(router *router.Router[*core.RequestEvent], app core.App, engine *templating.Engine) error {
|
||||
router.GET(p.URL, func(e *core.RequestEvent) error {
|
||||
router.GET(p.URL, p.GET(engine, app))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *AlmanachPage) GET(engine *templating.Engine, app core.App) HandleFunc {
|
||||
return func(e *core.RequestEvent) error {
|
||||
id := e.Request.PathValue("id")
|
||||
data := make(map[string]interface{})
|
||||
data := make(map[string]any)
|
||||
filters := NewBeitraegeFilterParameters(e)
|
||||
result, err := NewAlmanachResult(app, id, filters)
|
||||
if err != nil {
|
||||
@@ -51,9 +56,7 @@ func (p *AlmanachPage) Setup(router *router.Router[*core.RequestEvent], app core
|
||||
}
|
||||
|
||||
return engine.Response200(e, p.Template, data)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
type AlmanachResult struct {
|
||||
|
||||
@@ -39,8 +39,21 @@ func (p *AlmanachEditPage) Setup(router *router.Router[*core.RequestEvent], app
|
||||
|
||||
func (p *AlmanachEditPage) GET(engine *templating.Engine, app core.App) HandleFunc {
|
||||
return func(e *core.RequestEvent) error {
|
||||
id := e.Request.PathValue("id")
|
||||
data := make(map[string]any)
|
||||
filters := NewBeitraegeFilterParameters(e)
|
||||
result, err := NewAlmanachResult(app, id, filters)
|
||||
if err != nil {
|
||||
engine.Response404(e, err, nil)
|
||||
}
|
||||
data["result"] = result
|
||||
data["filters"] = filters
|
||||
|
||||
return engine.Response200(e, p.Template, data)
|
||||
abbrs, err := pagemodels.GetAbks(app)
|
||||
if err == nil {
|
||||
data["abbrs"] = abbrs
|
||||
}
|
||||
|
||||
return engine.Response200(e, p.Template, data, p.Layout)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user