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:
+7
-3
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user