From 68f2ccdea34160b80a566177b849b1fe3bfbc713 Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Fri, 15 May 2026 09:56:28 +0200 Subject: [PATCH] =?UTF-8?q?fix(04):=20badge=20count=20+=20DnD=20init=20?= =?UTF-8?q?=E2=80=94=20use=20DOMContentLoaded/htmx:afterSettle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace htmx.onLoad (requires htmx at parse time) with native document.addEventListener('DOMContentLoaded') + 'htmx:afterSettle' so Sortable.js is guaranteed loaded before init runs. Add task-count-badge-{status} wrapper IDs and updateBadges() that recounts .task-card elements on every HTMX settle so badge counts stay in sync after create, delete, and reorder operations. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- backend/templates/tasks.templ | 88 +++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/backend/templates/tasks.templ b/backend/templates/tasks.templ index 0407169..5297a10 100644 --- a/backend/templates/tasks.templ +++ b/backend/templates/tasks.templ @@ -38,38 +38,66 @@ templ KanbanBoard(tabloID uuid.UUID, csrfToken string, tasks []sqlc.Task) { @KanbanColumn(tabloID, status, grouped[status], csrfToken) } } @@ -80,7 +108,9 @@ templ KanbanColumn(tabloID uuid.UUID, status sqlc.TaskStatus, tasks []sqlc.Task,

{ TaskColumnLabels[status] }

- @ui.Badge(ui.BadgeProps{Label: strconv.Itoa(len(tasks)), Variant: ui.BadgeVariantInfo}) + + @ui.Badge(ui.BadgeProps{Label: strconv.Itoa(len(tasks)), Variant: ui.BadgeVariantInfo}) +