summaryrefslogtreecommitdiff
path: root/internal/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers')
-rw-r--r--internal/handlers/handlers.go36
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()