Added titles; updated the items list view

This commit is contained in:
Gregory Ballantine 2022-12-07 22:12:46 -05:00
parent ba0eb8649b
commit ec78e5e1ae
2 changed files with 5 additions and 0 deletions

View File

@ -10,16 +10,19 @@ import (
func RegisterRoutes(f *flamego.Flame) {
// index route - landing page for the user
f.Get("/", func(t template.Template, data template.Data) {
data["title"] = "Dashboard"
t.HTML(http.StatusOK, "index")
})
// item list route - lists all of the items in the database
f.Group("/item", func() {
f.Get("/list", func(t template.Template, data template.Data) {
data["title"] = "List of Inventory"
t.HTML(http.StatusOK, "item/list")
})
f.Get("/create", func(t template.Template, data template.Data) {
data["title"] = "Create New Item"
t.HTML(http.StatusOK, "item/create")
})
})

View File

@ -5,6 +5,8 @@
<ul>
{{ range .inventory }}
<li>{{ .name }}</li>
{{ else }}
<p>There are currently no items registered in your inventory.</p>
{{ end }}
</ul>