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 --- internal/handlers/handlers.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'internal') 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() -- cgit v1.2.3