Inventory is now the Market
Everything the user sees says Market: the sidebar, titles, breadcrumbs, help text, messages, suggestions and the agent tool's description; the export downloads as supermarket-market.yaml. Its pages live under /market, and the old /inventory addresses redirect there (308, so a form's POST stays a POST). The YAML format (inventory:), the database and the code's names are unchanged, so exported files still import. A breadcrumb no longer repeats the page's own title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+21
-10
@@ -97,15 +97,19 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
|
||||
mux.HandleFunc("GET /search", s.searchPage)
|
||||
|
||||
mux.HandleFunc("GET /inventory", s.inventoryList)
|
||||
mux.HandleFunc("GET /inventory/new", s.inventoryEdit)
|
||||
mux.HandleFunc("GET /inventory/{id}", s.inventoryEdit)
|
||||
mux.HandleFunc("POST /inventory/save", s.inventorySave)
|
||||
mux.HandleFunc("POST /inventory/fill", s.inventoryFill)
|
||||
mux.HandleFunc("POST /inventory/{id}/delete", s.inventoryDelete)
|
||||
mux.HandleFunc("GET /inventory/import", s.inventoryImportPage)
|
||||
mux.HandleFunc("POST /inventory/import", s.inventoryImport)
|
||||
mux.HandleFunc("GET /inventory/export", s.inventoryExport)
|
||||
mux.HandleFunc("GET /market", s.inventoryList)
|
||||
mux.HandleFunc("GET /market/new", s.inventoryEdit)
|
||||
mux.HandleFunc("GET /market/{id}", s.inventoryEdit)
|
||||
mux.HandleFunc("POST /market/save", s.inventorySave)
|
||||
mux.HandleFunc("POST /market/fill", s.inventoryFill)
|
||||
mux.HandleFunc("POST /market/{id}/delete", s.inventoryDelete)
|
||||
mux.HandleFunc("GET /market/import", s.inventoryImportPage)
|
||||
mux.HandleFunc("POST /market/import", s.inventoryImport)
|
||||
mux.HandleFunc("GET /market/export", s.inventoryExport)
|
||||
// The Market was the Inventory: its old addresses lead to the new ones
|
||||
// (308 keeps a form's POST a POST).
|
||||
mux.HandleFunc("/inventory", marketMoved)
|
||||
mux.HandleFunc("/inventory/", marketMoved)
|
||||
|
||||
// Settings: the profile, social accounts, AI, and the Core & Hermes.
|
||||
mux.HandleFunc("GET /settings", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -476,7 +480,7 @@ func (p page) Section() string {
|
||||
case strings.HasPrefix(p.Nav, "settings"):
|
||||
return "Settings"
|
||||
case p.Nav == "inventory":
|
||||
return "Inventory"
|
||||
return "Market"
|
||||
case strings.HasPrefix(p.Nav, "sites"):
|
||||
return "Sites"
|
||||
}
|
||||
@@ -705,3 +709,10 @@ func ago(t time.Time) string {
|
||||
return t.Local().Format("2 Jan 2006")
|
||||
}
|
||||
}
|
||||
|
||||
// marketMoved sends an old /inventory address to its /market one.
|
||||
func marketMoved(w http.ResponseWriter, r *http.Request) {
|
||||
u := *r.URL
|
||||
u.Path = "/market" + strings.TrimPrefix(r.URL.Path, "/inventory")
|
||||
http.Redirect(w, r, u.RequestURI(), http.StatusPermanentRedirect)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user