From 13b0821eefd16f2e702f0fbcceda7ca4704a2625 Mon Sep 17 00:00:00 2001 From: Jocadbz Date: Mon, 23 Feb 2026 20:28:48 -0300 Subject: [PATCH] make chat.html self contained --- main.go | 3 +- templates/pages/chat.html | 128 ++++++++++++++++++++++---------------- 2 files changed, 74 insertions(+), 57 deletions(-) diff --git a/main.go b/main.go index affde63..6c738f2 100644 --- a/main.go +++ b/main.go @@ -356,9 +356,8 @@ func main() { log.Fatal("Error getting working directory:", err) } - // Parse base and partial templates + // Parse partial templates tmpl := template.Must(template.ParseFiles( - filepath.Join(dir, "templates/base.html"), filepath.Join(dir, "templates/partials/navbar.html"), filepath.Join(dir, "templates/partials/cookie_banner.html"), )) diff --git a/templates/pages/chat.html b/templates/pages/chat.html index d1f5e52..ebbd606 100644 --- a/templates/pages/chat.html +++ b/templates/pages/chat.html @@ -1,60 +1,78 @@ -{{define "chat"}}{{template "base" .}}{{end}} - -{{define "chat-content"}} -
-
- Home - - Boards - - {{.Board.Name}} -
-
-
-
- Connecting... -
-

{{.Board.Name}}

-

{{.Board.Description}}

-
-
-
- ... -
- {{range .Messages}} -
-
- {{if .PfpFileID.Valid}} - PFP - {{else}} -
+{{define "chat"}} + + + + {{.Title}} + + + + + + + + + + + {{template "navbar" .}} +
+
+
+ Home + + Boards + + {{.Board.Name}} +
+
+
+
+ Connecting... +
+

{{.Board.Name}}

+

{{.Board.Description}}

+
+
+
+ ... +
+ {{range .Messages}} +
+
+ {{if .PfpFileID.Valid}} + PFP + {{else}} +
+ {{end}} + {{.Username}} + {{.Timestamp.Format "02/01/2006 15:04"}} +
+ {{if gt .ReplyTo 0}} +
Replying to message...
+ {{end}} +
{{.Content}}
+
+ Reply +
+
{{end}} - {{.Username}} - {{.Timestamp.Format "02/01/2006 15:04"}}
- {{if gt .ReplyTo 0}} -
Replying to message...
- {{end}} -
{{.Content}}
-
- Reply + +
+
+ Replying to + +
+ +
- {{end}} -
- -
-
- Replying to - -
- - -
-
-
- +
+ + + {{template "cookie_banner" .}} + + {{end}}