Toggle tasks and edit view settings via htmx

Task checkboxes post themselves (hx-post="?toggle=N") and flip back when
the save fails, replacing tasks.js. View settings are a server-rendered
form dialog with real radios and a select, replacing view-settings.js;
with that, postReplace has no callers left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 16:41:59 +02:00
co-authored by Claude Opus 5.5
parent 3a3fb3b51f
commit 353df29ee6
12 changed files with 93 additions and 162 deletions
+7 -3
View File
@@ -46,13 +46,17 @@ func renderDialog(w http.ResponseWriter, name string, data any) {
}
// serveDialog handles GET ?dialog=<name> for the page at urlPath.
func (h *handler) serveDialog(w http.ResponseWriter, r *http.Request, urlPath string) {
func (h *handler) serveDialog(w http.ResponseWriter, r *http.Request, urlPath, fsPath string) {
page := normalizeMovePath(urlPath)
if page == "/" {
name := r.URL.Query().Get("dialog")
if page == "/" && (name == "delete" || name == "move") {
http.Error(w, "not available for the wiki root", http.StatusBadRequest)
return
}
switch r.URL.Query().Get("dialog") {
switch name {
case "view":
view, sortKey, order := readPageSettings(fsPath).viewSettings()
renderDialog(w, "view", struct{ View, Sort, Order string }{view, sortKey, order})
case "delete":
renderDialog(w, "delete", struct{ Path string }{urlPath})
case "move":