From 539122f3c80fe1f27348f0ddfc7fd428a58384b8 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 22 Jan 2026 21:00:38 -1000 Subject: Add shopping quick-add feature - Add Shopping tab to action modal (Ctrl+K) - Add /partials/shopping-lists endpoint to fetch lists from Shopping board - Store dropdown populated dynamically from Trello - Items added via existing unified-add endpoint Co-Authored-By: Claude Opus 4.5 --- cmd/dashboard/main.go | 1 + internal/handlers/handlers.go | 36 ++++++++++++++++++++++++++++++ web/templates/index.html | 52 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index 7645048..da49165 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -148,6 +148,7 @@ func main() { // Unified Quick Add (for Tasks tab) r.Post("/unified-add", h.HandleUnifiedAdd) r.Get("/partials/lists", h.HandleGetListsOptions) + r.Get("/partials/shopping-lists", h.HandleGetShoppingLists) // Task detail/edit r.Get("/tasks/detail", h.HandleGetTaskDetail) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 84a00fd..c44e771 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -1004,6 +1004,42 @@ func (h *Handler) HandleGetTaskDetail(w http.ResponseWriter, r *http.Request) { w.Write([]byte(html)) } +// HandleGetShoppingLists returns the lists from the Shopping board for quick-add +func (h *Handler) HandleGetShoppingLists(w http.ResponseWriter, r *http.Request) { + boards, err := h.store.GetBoards() + if err != nil { + http.Error(w, "Failed to get boards", http.StatusInternalServerError) + return + } + + // Find the Shopping board + var shoppingBoardID string + for _, b := range boards { + if strings.EqualFold(b.Name, "Shopping") { + shoppingBoardID = b.ID + break + } + } + + if shoppingBoardID == "" { + http.Error(w, "Shopping board not found", http.StatusNotFound) + return + } + + // Get lists for the shopping board + lists, err := h.trelloClient.GetLists(r.Context(), shoppingBoardID) + if err != nil { + http.Error(w, "Failed to get lists", http.StatusInternalServerError) + log.Printf("Error fetching shopping lists: %v", err) + return + } + + w.Header().Set("Content-Type", "text/html") + for _, list := range lists { + fmt.Fprintf(w, ``, list.ID, list.Name) + } +} + // HandleUpdateTask updates a task description func (h *Handler) HandleUpdateTask(w http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/web/templates/index.html b/web/templates/index.html index f525a09..32c0857 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -87,7 +87,11 @@
+
+ + +