From bf021090aba8eed1bda71bc394cef2018c5773eb Mon Sep 17 00:00:00 2001 From: Patryk Hegenberg Date: Wed, 29 Nov 2023 16:17:36 +0100 Subject: [PATCH] seperate main template from monster form --- main.go | 2 +- templates/main.html | 117 +----------------------------------- templates/monsterForm.html | 118 +++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 117 deletions(-) create mode 100644 templates/monsterForm.html diff --git a/main.go b/main.go index 2d9876c..8bb32c8 100644 --- a/main.go +++ b/main.go @@ -116,7 +116,7 @@ func main() { func formHandler(filename string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - tmpl, err := template.ParseFS(content, "templates/base.html", "templates/header.html", "templates/main.html", "templates/footer.html") + tmpl, err := template.ParseFS(content, "templates/base.html", "templates/header.html", "templates/main.html", "templates/footer.html", "templates/monsterForm.html") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/templates/main.html b/templates/main.html index 35b6123..2cc0118 100644 --- a/templates/main.html +++ b/templates/main.html @@ -7,122 +7,7 @@
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
+ {{ template "monsterform" . }}
diff --git a/templates/monsterForm.html b/templates/monsterForm.html new file mode 100644 index 0000000..75aa5e0 --- /dev/null +++ b/templates/monsterForm.html @@ -0,0 +1,118 @@ +{{ define "monsterform" }} +
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+{{end}} \ No newline at end of file