Added more frontend and some more login logic
This commit is contained in:
@@ -7,12 +7,34 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var dashbaord = template.Must(template.ParseFiles(
|
||||
var dashboard = template.Must(template.ParseFiles(
|
||||
"frontend/htmx/contents/dash/base.html",
|
||||
"frontend/htmx/contents/dash/dashboard.html"))
|
||||
|
||||
var inventory = template.Must(template.ParseFiles(
|
||||
"frontend/htmx/contents/dash/base.html",
|
||||
"frontend/htmx/contents/dash/inventory.html"))
|
||||
|
||||
var item = template.Must(template.ParseFiles(
|
||||
"frontend/htmx/contents/dash/base.html",
|
||||
"frontend/htmx/contents/dash/itemlist.html"))
|
||||
|
||||
var locations = template.Must(template.ParseFiles(
|
||||
"frontend/htmx/contents/dash/base.html",
|
||||
"frontend/htmx/contents/dash/locations.html"))
|
||||
|
||||
var projects = template.Must(template.ParseFiles(
|
||||
"frontend/htmx/contents/dash/base.html",
|
||||
"frontend/htmx/contents/dash/projects.html"))
|
||||
|
||||
var home = template.Must(template.ParseFiles("frontend/htmx/home.html"))
|
||||
|
||||
func Home(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
http.ServeFile(w, r, "frontend/htmx/404.html")
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := home.Execute(w, struct {
|
||||
Name string
|
||||
@@ -26,7 +48,51 @@ func Home(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := dashbaord.Execute(w, struct {
|
||||
err := dashboard.ExecuteTemplate(w, "base.html", struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "Miau",
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
func Inventory(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := inventory.ExecuteTemplate(w, "base.html", struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "Miau",
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
func Items(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := item.ExecuteTemplate(w, "base.html", struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "Miau",
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
func Locations(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := locations.ExecuteTemplate(w, "base.html", struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "Miau",
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
func Projects(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
err := projects.ExecuteTemplate(w, "base.html", struct {
|
||||
Title string
|
||||
}{
|
||||
Title: "Miau",
|
||||
|
||||
Reference in New Issue
Block a user