summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-02-08 17:00:30 +0000
committerMatthew Lemon <y@yulqen.org>2024-02-08 17:00:30 +0000
commitfc37ba24c45874e4fe1b5568f96887e5563547e0 (patch)
treed882f5aab9c8ab7d181027efefe0e53a6c752811
parentced9bbed371d7a1d7692c820f80c77f43ebd32a3 (diff)
Added nav partial
Added a partial html for the navigation bar. So far it just has a link to "Home" on it.
-rw-r--r--cmd/web/handlers.go4
-rw-r--r--ui/html/base.tmpl.html2
-rw-r--r--ui/html/partials/nav.tmpl.html5
3 files changed, 8 insertions, 3 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go
index 8df8928..4b76103 100644
--- a/cmd/web/handlers.go
+++ b/cmd/web/handlers.go
@@ -27,7 +27,7 @@ func (app *application) listOrganisation(w http.ResponseWriter, r *http.Request)
files := []string{
"./ui/html/base.tmpl.html",
"./ui/html/pages/organisations/list.tmpl.html",
- // "./ui/html/partials/nav.tmpl.html",
+ "./ui/html/partials/nav.tmpl.html",
}
ts, err := template.ParseFiles(files...)
@@ -51,7 +51,7 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) {
files := []string{
"./ui/html/base.tmpl.html",
"./ui/html/pages/home.tmpl.html",
- // "./ui/html/partials/nav.tmpl.html",
+ "./ui/html/partials/nav.tmpl.html",
}
ts, err := template.ParseFiles(files...)
diff --git a/ui/html/base.tmpl.html b/ui/html/base.tmpl.html
index cb98c32..91bdbc2 100644
--- a/ui/html/base.tmpl.html
+++ b/ui/html/base.tmpl.html
@@ -11,7 +11,7 @@
</head>
<body>
<header>
- <h1><a href="/">DED</a></h1>
+ {{ template "nav" . }}
</header>
<main>
{{ template "main" }}
diff --git a/ui/html/partials/nav.tmpl.html b/ui/html/partials/nav.tmpl.html
new file mode 100644
index 0000000..9636855
--- /dev/null
+++ b/ui/html/partials/nav.tmpl.html
@@ -0,0 +1,5 @@
+{{ define "nav" }}
+<nav>
+ <a href="/">Home</a>
+</nav>
+{{ end }}