make chat.html self contained

jocadbz
Joca 2026-02-23 20:28:48 -03:00
parent d6fe1544e0
commit 13b0821eef
Signed by: jocadbz
GPG Key ID: B1836DCE2F50BDF7
2 changed files with 74 additions and 57 deletions

View File

@ -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"),
))

View File

@ -1,6 +1,20 @@
{{define "chat"}}{{template "base" .}}{{end}}
{{define "chat-content"}}
{{define "chat"}}
<!DOCTYPE html>
<html>
<head>
<title>{{.Title}}</title>
<link rel="stylesheet" href="{{.StaticPath}}/style.css">
<script src="{{.StaticPath}}/validation.js" defer></script>
<script src="{{.StaticPath}}/drafts.js" defer></script>
<script src="{{.StaticPath}}/forms.js" defer></script>
<script src="{{.StaticPath}}/shortcuts.js" defer></script>
<script src="{{.StaticPath}}/likes.js" defer></script>
<script src="{{.StaticPath}}/app.js" defer></script>
<script src="{{.StaticPath}}/chat.js" defer></script>
</head>
<body class="chat-page">
{{template "navbar" .}}
<main>
<div class="chat-container" data-board-id="{{.Board.ID}}" data-base-path="{{.BasePath}}" data-current-username="{{.CurrentUsername}}">
<div class="chat-breadcrumb">
<a href="{{.BasePath}}/">Home</a>
@ -57,4 +71,8 @@
</div>
<div id="autocomplete-popup" class="autocomplete-popup"></div>
<script type="application/json" id="chat-usernames">{{.AllUsernames}}</script>
</main>
{{template "cookie_banner" .}}
</body>
</html>
{{end}}