+better site editor, redirect to view on saving

This commit is contained in:
Simon Martens
2026-01-14 20:35:30 +01:00
parent f724cdf975
commit ff5f080f6c
12 changed files with 16 additions and 35 deletions

View File

@@ -229,6 +229,7 @@ func (p *AlmanachEditPage) POSTSave(engine *templating.Engine, app core.App) Han
"success": true, "success": true,
"message": "Änderungen gespeichert.", "message": "Änderungen gespeichert.",
"updated": updatedInfo, "updated": updatedInfo,
"redirect": fmt.Sprintf("/almanach/%s/", id),
}) })
} }
} }

View File

@@ -2,7 +2,6 @@ package controllers
import ( import (
"net/http" "net/http"
"net/url"
"strconv" "strconv"
"github.com/Theodor-Springmann-Stiftung/musenalm/app" "github.com/Theodor-Springmann-Stiftung/musenalm/app"
@@ -164,7 +163,7 @@ func (p *AlmanachNewPage) POSTSave(engine *templating.Engine, app core.App) Hand
redirect := "/" redirect := "/"
if entry != nil { 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{ return e.JSON(http.StatusOK, map[string]any{

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -232,7 +231,7 @@ func (p *OrtEditPage) POST(engine *templating.Engine, app core.App) HandleFunc {
} }
}(app, place.Id, nameChanged) }(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) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -143,11 +142,7 @@ func (p *OrtNewPage) POST(engine *templating.Engine, app core.App) HandleFunc {
} }
}(app, createdPlace.Id) }(app, createdPlace.Id)
redirect := fmt.Sprintf( redirect := fmt.Sprintf("/ort/%s/", createdPlace.Id)
"/ort/%s/edit?saved_message=%s",
createdPlace.Id,
url.QueryEscape("Änderungen gespeichert."),
)
return e.Redirect(http.StatusSeeOther, redirect) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -344,7 +343,7 @@ func (p *PersonEditPage) POST(engine *templating.Engine, app core.App) HandleFun
} }
}(app, agent.Id, nameChanged) }(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) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -147,11 +146,7 @@ func (p *PersonNewPage) POST(engine *templating.Engine, app core.App) HandleFunc
} }
}(app, createdAgent.Id) }(app, createdAgent.Id)
redirect := fmt.Sprintf( redirect := fmt.Sprintf("/person/%s", createdAgent.Id)
"/person/%s/edit?saved_message=%s",
createdAgent.Id,
url.QueryEscape("Änderungen gespeichert."),
)
return e.Redirect(http.StatusSeeOther, redirect) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -444,7 +443,7 @@ func (p *ReiheEditPage) POST(engine *templating.Engine, app core.App) HandleFunc
} }
}(app, series.Id, titleChanged) }(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) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -3,7 +3,6 @@ package controllers
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"slices" "slices"
"strings" "strings"
@@ -147,11 +146,7 @@ func (p *ReiheNewPage) POST(engine *templating.Engine, app core.App) HandleFunc
} }
}(app, createdSeries.Id) }(app, createdSeries.Id)
redirect := fmt.Sprintf( redirect := fmt.Sprintf("/reihe/%d/", createdSeries.MusenalmID())
"/reihe/%d/edit?saved_message=%s",
createdSeries.MusenalmID(),
url.QueryEscape("Änderungen gespeichert."),
)
return e.Redirect(http.StatusSeeOther, redirect) return e.Redirect(http.StatusSeeOther, redirect)
} }
} }

View File

@@ -8813,11 +8813,11 @@ class Qc extends HTMLElement {
</a> </a>
</div> </div>
<div class="grid grid-cols-[1fr_auto] group"> <div class="grid grid-cols-[1fr_auto] group">
<a href="/redaktion/seiten/" class="flex items-center px-4 py-2 group-hover:bg-gray-100 transition-colors no-underline text-sm"> <a href="/redaktion/seiten/" hx-boost="false" class="flex items-center px-4 py-2 group-hover:bg-gray-100 transition-colors no-underline text-sm">
<i class="ri-pages-line text-base text-gray-700 mr-2.5"></i> <i class="ri-pages-line text-base text-gray-700 mr-2.5"></i>
<span class="text-gray-900">Seiten</span> <span class="text-gray-900">Seiten</span>
</a> </a>
<a href="/redaktion/seiten/" target="_blank" class="flex items-center justify-center px-3 py-2 group-hover:bg-gray-100 text-gray-700 hover:text-slate-900 transition-colors no-underline text-sm" title="In neuem Tab öffnen"> <a href="/redaktion/seiten/" target="_blank" hx-boost="false" class="flex items-center justify-center px-3 py-2 group-hover:bg-gray-100 text-gray-700 hover:text-slate-900 transition-colors no-underline text-sm" title="In neuem Tab öffnen">
<i class="ri-external-link-line text-base"></i> <i class="ri-external-link-line text-base"></i>
</a> </a>
</div> </div>

View File

@@ -16,7 +16,7 @@
<select <select
id="page-editor-select" id="page-editor-select"
name="key" name="key"
class="inputinput px-3 py-2 bg-white border border-slate-300 shadow-sm focus:border-slate-500 focus:ring-2 focus:ring-slate-400/30" class="inputinput px-4 py-2 bg-white rounded-md border border-slate-300 shadow-sm focus:border-slate-500 focus:ring-2 focus:ring-slate-400/30"
onchange="window.location.href = '/redaktion/seiten/?key=' + encodeURIComponent(this.value);"> onchange="window.location.href = '/redaktion/seiten/?key=' + encodeURIComponent(this.value);">
{{- if $model.pages -}} {{- if $model.pages -}}
{{- range $page := $model.pages -}} {{- range $page := $model.pages -}}

View File

@@ -53,7 +53,6 @@
<div class="inputlabelrow"> <div class="inputlabelrow">
<div class="flex flex-col"> <div class="flex flex-col">
<label for="page-html-{{ $index }}" class="inputlabel">{{ $section.Label }}</label> <label for="page-html-{{ $index }}" class="inputlabel">{{ $section.Label }}</label>
<span class="text-xs text-gray-500">{{ $section.Key }}</span>
</div> </div>
</div> </div>

View File

@@ -189,11 +189,11 @@ export class FabMenu extends HTMLElement {
</a> </a>
</div> </div>
<div class="grid grid-cols-[1fr_auto] group"> <div class="grid grid-cols-[1fr_auto] group">
<a href="/redaktion/seiten/" class="flex items-center px-4 py-2 group-hover:bg-gray-100 transition-colors no-underline text-sm"> <a href="/redaktion/seiten/" hx-boost="false" class="flex items-center px-4 py-2 group-hover:bg-gray-100 transition-colors no-underline text-sm">
<i class="ri-pages-line text-base text-gray-700 mr-2.5"></i> <i class="ri-pages-line text-base text-gray-700 mr-2.5"></i>
<span class="text-gray-900">Seiten</span> <span class="text-gray-900">Seiten</span>
</a> </a>
<a href="/redaktion/seiten/" target="_blank" class="flex items-center justify-center px-3 py-2 group-hover:bg-gray-100 text-gray-700 hover:text-slate-900 transition-colors no-underline text-sm" title="In neuem Tab öffnen"> <a href="/redaktion/seiten/" target="_blank" hx-boost="false" class="flex items-center justify-center px-3 py-2 group-hover:bg-gray-100 text-gray-700 hover:text-slate-900 transition-colors no-underline text-sm" title="In neuem Tab öffnen">
<i class="ri-external-link-line text-base"></i> <i class="ri-external-link-line text-base"></i>
</a> </a>
</div> </div>