From c7b18e70ea87c287240243aed867b3a8b51689cb Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 20 Sep 2026 08:11:38 +0000 Subject: Make shopping items editable: tap to rename, move store/section, delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping an item outside shopping mode now opens an edit sheet. User-added items can be renamed, moved between stores and sections, and deleted. PlanToEat items show why they cannot be edited — the client is read-only, so presenting fields that silently would not save is worse than saying so — and offer removal, which marks them checked, the same mechanism shopping mode already uses. This needed a store registry first. Stores previously existed only because some item referenced them by name, with Trello's list names quietly acting as the registry; removing Trello as a source made the gap visible. Without a registry you cannot move an item into an empty store, and moving the last item out of a store makes it vanish mid-edit. Migration 034 adds shopping_stores and shopping_sections, seeded from the stores currently in use, and gives items a section column — sections previously existed only as PlanToEat category strings, so a user item could not be filed under one at all. Registered stores and sections now appear in the list even when empty, which is the whole point of the registry. Two deliberate choices about destructive edges: * Renaming a store renames it and moves its items in one transaction. Items reference the store by name, so doing either alone orphans them. * Deleting a store or section keeps the items, moving them to Unassigned or clearing the section. Losing the list is far worse than re-filing an item. * An UPDATE matching no rows is an error, not a silent success, so a stale id cannot look like a saved edit. Section options are rebuilt per store in the edit sheet rather than shipped as one flat list, so a Costco item cannot be filed under a Safeway aisle. 18 new store tests, 11 handler tests. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B --- cmd/dashboard/main.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd') diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index 56251e0..f66e2c5 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -370,6 +370,11 @@ func main() { // Shopping quick-add r.Get("/partials/shopping-stores", h.HandleGetShoppingStores) r.Post("/shopping/add", h.HandleShoppingQuickAdd) + r.Get("/shopping/item/{id}/edit", h.HandleShoppingItemEdit) + r.Post("/shopping/item/{id}", h.HandleShoppingItemUpdate) + r.Delete("/shopping/item/{id}", h.HandleShoppingItemDelete) + r.Post("/shopping/stores", h.HandleShoppingStoreCreate) + r.Post("/shopping/sections", h.HandleShoppingSectionCreate) // Shopping mode (focused single-store view) r.Get("/shopping/mode/{store}", h.HandleShoppingMode) -- cgit v1.2.3