diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 21:00:38 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-22 21:00:38 -1000 |
| commit | 539122f3c80fe1f27348f0ddfc7fd428a58384b8 (patch) | |
| tree | 069eadd594ac20df355f52fc13d435dcd26104f6 /internal | |
| parent | bedcd8a185e4197d087b2166afa79ff4dce25f7c (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/handlers/handlers.go | 36 |
1 files changed, 36 insertions, 0 deletions
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, `<option value="%s">%s</option>`, list.ID, list.Name) + } +} + // HandleUpdateTask updates a task description func (h *Handler) HandleUpdateTask(w http.ResponseWriter, r *http.Request) { ctx := r.Context() |
