diff --git a/routes/boxes.go b/routes/boxes.go index 71ec8f2..e4b0441 100644 --- a/routes/boxes.go +++ b/routes/boxes.go @@ -37,7 +37,7 @@ func GetAllBoxes(_ *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-list.html", + "boxes/box-list.html", result, nil, ) diff --git a/routes/items.go b/routes/items.go index 38b7152..0f201c0 100644 --- a/routes/items.go +++ b/routes/items.go @@ -10,13 +10,13 @@ import ( ) type ItemActions struct { - Get func(r *http.Request) *web.Response - GetAll func(r *http.Request) *web.Response - Edit func(r *http.Request) *web.Response - Delete func(r *http.Request) *web.Response - Save func(r *http.Request) *web.Response - Post func(r *http.Request) *web.Response - Add func(r *http.Request) *web.Response + Get func(r *http.Request) *web.Response + GetAll func(r *http.Request) *web.Response + Edit func(r *http.Request) *web.Response + Delete func(r *http.Request) *web.Response + Save func(r *http.Request) *web.Response + Post func(r *http.Request) *web.Response + Add func(r *http.Request) *web.Response } func Items(_html *template.Template) *ItemActions { @@ -36,7 +36,7 @@ func Items(_html *template.Template) *ItemActions { func Get(r *http.Request) *web.Response { _, count := web.PathLast(r) - if count == 0 { + if count == 1 { return GetAllItems(r) } else { return GetItemByID(r) @@ -52,7 +52,7 @@ func GetAllItems(_ *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-list.html", + "items/entity-list.html", result, nil, ) @@ -75,7 +75,7 @@ func EditItem(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-edit.html", + "items/entity-edit.html", result, nil, ) @@ -98,7 +98,7 @@ func GetItemByID(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-row.html", + "items/entity-row.html", result, nil, ) @@ -154,7 +154,7 @@ func Put(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-row.html", + "items/entity-row.html", item, nil, ) @@ -197,7 +197,7 @@ func Post(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-row.html", + "items/entity-row.html", item, nil, ) @@ -207,7 +207,7 @@ func Add(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-add.html", + "items/items/entity-add.html", nil, nil, ) @@ -230,7 +230,7 @@ func Delete(r *http.Request) *web.Response { return web.HTML( http.StatusOK, html, - "entity-row.html", + "items/entity-row.html", nil, nil, ) diff --git a/templates/boxes.html b/templates/boxes/box-list.html similarity index 64% rename from templates/boxes.html rename to templates/boxes/box-list.html index 2c8eed5..6cfa833 100644 --- a/templates/boxes.html +++ b/templates/boxes/box-list.html @@ -1,35 +1,25 @@ -
+
Processing...
- + + {{range .}} - {{ template "entity-row.html". }} + {{ template "boxes/box-row.html" . }} {{end}}
# Name Stage Category Description Notes
diff --git a/templates/boxes/box-row.html b/templates/boxes/box-row.html new file mode 100644 index 0000000..60526e7 --- /dev/null +++ b/templates/boxes/box-row.html @@ -0,0 +1,38 @@ + + + < + + {{.ID}} + {{.Name}} + + {{ template "components/parsed-packing-stage.html" .Stage }} + + {{ template "components/parsed-category.html" .Category }} + + {{ if .Description }} + {{.Description}} + {{ else }} + ... + {{ end }} + + {{ if .Notes }} + {{.Notes}} + {{ else }} + ... + {{ end }} + + + + diff --git a/templates/companies.html b/templates/companies.html deleted file mode 100644 index cbf5b65..0000000 --- a/templates/companies.html +++ /dev/null @@ -1,38 +0,0 @@ -
-
Processing...
-
-
-
-
-
- -
- - - - - - - - - - - {{range .}} - {{ template "row.html". }} - {{end}} - -
#CompanyContactCountry
-
-
-
-
-
diff --git a/templates/company-add.html b/templates/company-add.html deleted file mode 100644 index 3fab4c8..0000000 --- a/templates/company-add.html +++ /dev/null @@ -1,6 +0,0 @@ - - {{ template "row-add.html" . }} - {{range .}} - {{ template "row.html". }} - {{end}} - diff --git a/templates/parsed-category.html b/templates/components/parsed-category.html similarity index 100% rename from templates/parsed-category.html rename to templates/components/parsed-category.html diff --git a/templates/parsed-packing-stage.html b/templates/components/parsed-packing-stage.html similarity index 100% rename from templates/parsed-packing-stage.html rename to templates/components/parsed-packing-stage.html diff --git a/templates/index.html b/templates/index.html index 1817ef1..7b36785 100644 --- a/templates/index.html +++ b/templates/index.html @@ -36,7 +36,7 @@
Items
- {{ template "entity-list.html" . }} + {{ template "items/entity-list.html" . }}
diff --git a/templates/entity-add.html b/templates/items/entity-add.html similarity index 100% rename from templates/entity-add.html rename to templates/items/entity-add.html diff --git a/templates/entity-edit.html b/templates/items/entity-edit.html similarity index 100% rename from templates/entity-edit.html rename to templates/items/entity-edit.html diff --git a/templates/entity-list.html b/templates/items/entity-list.html similarity index 91% rename from templates/entity-list.html rename to templates/items/entity-list.html index f6dfe4a..14e48ed 100644 --- a/templates/entity-list.html +++ b/templates/items/entity-list.html @@ -6,7 +6,7 @@