summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-03-03 17:12:14 +0100
committerxengineering <me@xengineering.eu>2024-03-03 17:12:14 +0100
commitd35bd7c65d062ca30852c901f6e98a05ceb309d7 (patch)
treeec334d5ff2bde62d6a18060de6f0fb3518d4f1fe /view
parent439f49d4afb1f2bfc9a7aaf63bac7c560486c93c (diff)
downloadceres-d35bd7c65d062ca30852c901f6e98a05ceb309d7.tar
ceres-d35bd7c65d062ca30852c901f6e98a05ceb309d7.tar.zst
ceres-d35bd7c65d062ca30852c901f6e98a05ceb309d7.zip
view: Add template 'nav'
The <nav> section is the same on every page. This new template reduces code duplication.
Diffstat (limited to 'view')
-rw-r--r--view/html/nav.html5
-rw-r--r--view/html/recipe-confirm-deletion.html4
-rw-r--r--view/html/recipe-edit.html4
-rw-r--r--view/html/recipe.html4
-rw-r--r--view/html/recipes.html4
5 files changed, 9 insertions, 12 deletions
diff --git a/view/html/nav.html b/view/html/nav.html
new file mode 100644
index 0000000..7bc0206
--- /dev/null
+++ b/view/html/nav.html
@@ -0,0 +1,5 @@
+{{define "nav"}}
+ <nav>
+ <a href="/recipes">HOME</a>
+ </nav>
+{{end}}
diff --git a/view/html/recipe-confirm-deletion.html b/view/html/recipe-confirm-deletion.html
index 7e839cb..74d6ede 100644
--- a/view/html/recipe-confirm-deletion.html
+++ b/view/html/recipe-confirm-deletion.html
@@ -3,9 +3,7 @@
<html>
{{ template "head" }}
<header>
- <nav>
- <a href="/recipes">HOME</a>
- </nav>
+ {{ template "nav" }}
<h1>Delete a recipe</h1>
</header>
<body>
diff --git a/view/html/recipe-edit.html b/view/html/recipe-edit.html
index d7d9b45..125d876 100644
--- a/view/html/recipe-edit.html
+++ b/view/html/recipe-edit.html
@@ -3,9 +3,7 @@
<html>
{{ template "head" }}
<header>
- <nav>
- <a href="/recipes">HOME</a>
- </nav>
+ {{ template "nav" }}
<h1>Recipe editor</h1>
</header>
<body>
diff --git a/view/html/recipe.html b/view/html/recipe.html
index 7b1a70d..04230ea 100644
--- a/view/html/recipe.html
+++ b/view/html/recipe.html
@@ -3,9 +3,7 @@
<html>
{{ template "head" }}
<header>
- <nav>
- <a href="/recipes">HOME</a>
- </nav>
+ {{ template "nav" }}
<h1>{{.Title}}</h1>
</header>
<body>
diff --git a/view/html/recipes.html b/view/html/recipes.html
index ba7cd62..b5bf786 100644
--- a/view/html/recipes.html
+++ b/view/html/recipes.html
@@ -3,9 +3,7 @@
<html>
{{ template "head" }}
<header>
- <nav>
- <a href="/recipes">HOME</a>
- </nav>
+ {{ template "nav" }}
<h1>Recipe overview</h1>
</header>
<body>