go-htmx-gsd #1

Merged
arthur merged 558 commits from go-htmx-gsd into main 2026-05-23 15:16:44 +00:00
2 changed files with 7 additions and 1 deletions
Showing only changes of commit 392b5321be - Show all commits

View file

@ -276,7 +276,7 @@ func TaskDeleteHandler(deps TasksDeps) http.HandlerFunc {
if r.Header.Get("HX-Request") == "true" {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
// Return empty zone div so HTMX removes the card from the DOM (TASK-06).
fmt.Fprintf(w, `<div id="task-%s" class="task-card-zone"></div>`, task.ID.String())
_ = templates.TaskCardGone(task.ID).Render(r.Context(), w)
return
}
http.Redirect(w, r, "/tablos/"+tablo.ID.String(), http.StatusSeeOther)

View file

@ -338,6 +338,12 @@ templ AddTaskTrigger(tabloID uuid.UUID, status sqlc.TaskStatus, csrfToken string
>+ Add task</button>
}
// TaskCardGone renders an empty zone div with the task's id so HTMX outerHTML
// swap removes the card from the DOM after a successful delete (TASK-06).
templ TaskCardGone(taskID uuid.UUID) {
<div id={ "task-" + taskID.String() } class="task-card-zone"></div>
}
// TaskCardOOB renders a new TaskCard AND an OOB swap that resets the add-task
// slot to AddTaskTrigger. Used by TaskCreateHandler to perform both operations
// in a single HTMX response.