From cec39db23db603e87b969a5c630b5873f96a8be7 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 3 Oct 2025 10:57:34 +0200 Subject: feat(backend): create template for logs display --- backend/data.go | 2 +- backend/templates/home.html | 24 ++---------------------- backend/templates/home_log.html | 24 +----------------------- backend/templates/logs_display.html | 23 +++++++++++++++++++++++ 4 files changed, 27 insertions(+), 46 deletions(-) create mode 100644 backend/templates/logs_display.html diff --git a/backend/data.go b/backend/data.go index e841669..8922aca 100644 --- a/backend/data.go +++ b/backend/data.go @@ -75,7 +75,7 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string }, "next": func(i int) int { return i + 1 }, "before": func(i int) int { return i - 1 }, - }).ParseFS(templates, fmt.Sprintf("templates/%s.html", name), "templates/base.html") + }).ParseFS(templates, "templates/logs_display.html", fmt.Sprintf("templates/%s.html", name), "templates/base.html") if err != nil { panic(err) } diff --git a/backend/templates/home.html b/backend/templates/home.html index 37236ba..1a6b158 100644 --- a/backend/templates/home.html +++ b/backend/templates/home.html @@ -5,25 +5,5 @@ {{ .Description }}

-
- {{ range .Logs }} - - {{ end }} - {{ if ne .PagesNumber 1 }} - - {{ end }} -
-{{end}} \ No newline at end of file +{{ template "logs_display" . }} +{{end}} diff --git a/backend/templates/home_log.html b/backend/templates/home_log.html index dd5fdc1..2301ffd 100644 --- a/backend/templates/home_log.html +++ b/backend/templates/home_log.html @@ -1,23 +1 @@ -{{define "body"}} -
- {{ range .Logs }} - - {{ end }} - {{ if ne .PagesNumber 1 }} - - {{ end }} -
-{{end}} +{{define "body"}}{{ template "logs_display" . }}{{end}} diff --git a/backend/templates/logs_display.html b/backend/templates/logs_display.html new file mode 100644 index 0000000..d76d7c2 --- /dev/null +++ b/backend/templates/logs_display.html @@ -0,0 +1,23 @@ +{{define "logs_display"}} +
+ {{ range .Logs }} + + {{ end }} + {{ if ne .PagesNumber 1 }} + + {{ end }} +
+{{end}} -- cgit v1.2.3