From a7a9aa3dcfe4b90d9b32791c8313a0019ad11289 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 13 Jan 2026 14:20:41 -1000 Subject: Implement Todoist write operations - Handlers & UI (Part 2) Complete Todoist task creation and completion functionality: Handlers: - Update aggregateData to fetch and populate Projects - Add HandleCreateTask: creates task, refreshes list, re-renders - Add HandleCompleteTask: marks task complete, returns empty - Both handlers pass Projects to template for dropdown Routes: - Register POST /tasks for task creation - Register POST /tasks/complete for task completion UI (todoist-tasks.html): - Add Quick Add form with collapsible details element - Project selector dropdown (iterates over .Projects) - Content input field with validation - HTMX integration: hx-post, hx-target, hx-swap - Functional completion checkboxes on each task - Remove disabled attribute from checkboxes - Add todoist-task-item wrapper class for HTMX targeting - Glassmorphism styling for form Features: - Create Todoist tasks with optional project assignment - Mark tasks complete with single click (disappears) - Real-time task list updates without page reload - Seamless HTMX partial updates All tests pass. Full Todoist write operations now live in UI! Co-Authored-By: Claude Sonnet 4.5 --- cmd/dashboard/main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index a307484..4a1fb32 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -81,6 +81,10 @@ func main() { r.Post("/cards", h.HandleCreateCard) r.Post("/cards/complete", h.HandleCompleteCard) + // Todoist task operations + r.Post("/tasks", h.HandleCreateTask) + r.Post("/tasks/complete", h.HandleCompleteTask) + // Serve static files fileServer := http.FileServer(http.Dir("web/static")) r.Handle("/static/*", http.StripPrefix("/static/", fileServer)) -- cgit v1.2.3