From ff5f080f6c2fab1f26b3bed8e3a43ef07c603d2d Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Wed, 14 Jan 2026 20:35:30 +0100 Subject: [PATCH] +better site editor, redirect to view on saving --- controllers/almanach_edit.go | 7 ++++--- controllers/almanach_new.go | 3 +-- controllers/ort_edit.go | 3 +-- controllers/ort_new.go | 7 +------ controllers/person_edit.go | 3 +-- controllers/person_new.go | 7 +------ controllers/reihe_edit.go | 3 +-- controllers/reihe_new.go | 7 +------ views/assets/scripts.js | 4 ++-- views/routes/redaktion/seiten/body.gohtml | 2 +- views/routes/redaktion/seiten/components/_page_form.gohtml | 1 - views/transform/fab-menu.js | 4 ++-- 12 files changed, 16 insertions(+), 35 deletions(-) diff --git a/controllers/almanach_edit.go b/controllers/almanach_edit.go index fdf0bf9..78f4a3c 100644 --- a/controllers/almanach_edit.go +++ b/controllers/almanach_edit.go @@ -226,9 +226,10 @@ func (p *AlmanachEditPage) POSTSave(engine *templating.Engine, app core.App) Han } return e.JSON(http.StatusOK, map[string]any{ - "success": true, - "message": "Änderungen gespeichert.", - "updated": updatedInfo, + "success": true, + "message": "Änderungen gespeichert.", + "updated": updatedInfo, + "redirect": fmt.Sprintf("/almanach/%s/", id), }) } } diff --git a/controllers/almanach_new.go b/controllers/almanach_new.go index db3d7c8..1aa73d6 100644 --- a/controllers/almanach_new.go +++ b/controllers/almanach_new.go @@ -2,7 +2,6 @@ package controllers import ( "net/http" - "net/url" "strconv" "github.com/Theodor-Springmann-Stiftung/musenalm/app" @@ -164,7 +163,7 @@ func (p *AlmanachNewPage) POSTSave(engine *templating.Engine, app core.App) Hand redirect := "/" if entry != nil { - redirect = "/almanach/" + strconv.Itoa(entry.MusenalmID()) + "/edit?saved_message=" + url.QueryEscape("Änderungen gespeichert.") + redirect = "/almanach/" + strconv.Itoa(entry.MusenalmID()) + "/" } return e.JSON(http.StatusOK, map[string]any{ diff --git a/controllers/ort_edit.go b/controllers/ort_edit.go index f7f86db..0b248cc 100644 --- a/controllers/ort_edit.go +++ b/controllers/ort_edit.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -232,7 +231,7 @@ func (p *OrtEditPage) POST(engine *templating.Engine, app core.App) HandleFunc { } }(app, place.Id, nameChanged) - redirect := fmt.Sprintf("/ort/%s/edit?saved_message=%s", id, url.QueryEscape("Änderungen gespeichert.")) + redirect := fmt.Sprintf("/ort/%s/", id) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/controllers/ort_new.go b/controllers/ort_new.go index c040a23..aec2d75 100644 --- a/controllers/ort_new.go +++ b/controllers/ort_new.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -143,11 +142,7 @@ func (p *OrtNewPage) POST(engine *templating.Engine, app core.App) HandleFunc { } }(app, createdPlace.Id) - redirect := fmt.Sprintf( - "/ort/%s/edit?saved_message=%s", - createdPlace.Id, - url.QueryEscape("Änderungen gespeichert."), - ) + redirect := fmt.Sprintf("/ort/%s/", createdPlace.Id) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/controllers/person_edit.go b/controllers/person_edit.go index 1da5f6d..6578ff2 100644 --- a/controllers/person_edit.go +++ b/controllers/person_edit.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -344,7 +343,7 @@ func (p *PersonEditPage) POST(engine *templating.Engine, app core.App) HandleFun } }(app, agent.Id, nameChanged) - redirect := fmt.Sprintf("/person/%s/edit?saved_message=%s", id, url.QueryEscape("Änderungen gespeichert.")) + redirect := fmt.Sprintf("/person/%s", id) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/controllers/person_new.go b/controllers/person_new.go index 31ad617..93dc014 100644 --- a/controllers/person_new.go +++ b/controllers/person_new.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -147,11 +146,7 @@ func (p *PersonNewPage) POST(engine *templating.Engine, app core.App) HandleFunc } }(app, createdAgent.Id) - redirect := fmt.Sprintf( - "/person/%s/edit?saved_message=%s", - createdAgent.Id, - url.QueryEscape("Änderungen gespeichert."), - ) + redirect := fmt.Sprintf("/person/%s", createdAgent.Id) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/controllers/reihe_edit.go b/controllers/reihe_edit.go index 36e44f4..1b8dcd8 100644 --- a/controllers/reihe_edit.go +++ b/controllers/reihe_edit.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -444,7 +443,7 @@ func (p *ReiheEditPage) POST(engine *templating.Engine, app core.App) HandleFunc } }(app, series.Id, titleChanged) - redirect := fmt.Sprintf("/reihe/%s/edit?saved_message=%s", id, url.QueryEscape("Änderungen gespeichert.")) + redirect := fmt.Sprintf("/reihe/%s/", id) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/controllers/reihe_new.go b/controllers/reihe_new.go index b5a257b..19d0624 100644 --- a/controllers/reihe_new.go +++ b/controllers/reihe_new.go @@ -3,7 +3,6 @@ package controllers import ( "fmt" "net/http" - "net/url" "slices" "strings" @@ -147,11 +146,7 @@ func (p *ReiheNewPage) POST(engine *templating.Engine, app core.App) HandleFunc } }(app, createdSeries.Id) - redirect := fmt.Sprintf( - "/reihe/%d/edit?saved_message=%s", - createdSeries.MusenalmID(), - url.QueryEscape("Änderungen gespeichert."), - ) + redirect := fmt.Sprintf("/reihe/%d/", createdSeries.MusenalmID()) return e.Redirect(http.StatusSeeOther, redirect) } } diff --git a/views/assets/scripts.js b/views/assets/scripts.js index 10e9186..9839c35 100644 --- a/views/assets/scripts.js +++ b/views/assets/scripts.js @@ -8813,11 +8813,11 @@ class Qc extends HTMLElement {
- + Seiten - +
diff --git a/views/routes/redaktion/seiten/body.gohtml b/views/routes/redaktion/seiten/body.gohtml index 16bd635..e2c90cf 100644 --- a/views/routes/redaktion/seiten/body.gohtml +++ b/views/routes/redaktion/seiten/body.gohtml @@ -16,7 +16,7 @@