Feat: add error template

This commit is contained in:
Grail Finder
2025-05-04 08:47:22 +03:00
parent e335bf9dc8
commit 5dbb80121d
3 changed files with 12 additions and 1 deletions

9
components/error.html Normal file
View File

@ -0,0 +1,9 @@
{{define "error"}}
<a href="/">
<div id=errorbox class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4" role="alert">
<p class="font-bold">An error from server</p>
<p>{{.}}</p>
<p>Click this banner to return to main page.</p>
</div>
</a>
{{end}}

View File

@ -2,7 +2,8 @@
<div class="flex h-screen">
<!-- Left Panel -->
{{template "teampew" "blue"}}
{{template "cardtable" .}}
<!-- Right Panel -->
{{template "cardtable" "red"}}
{{template "teampew" "red"}}
</div>
{{end}}

View File

@ -16,6 +16,7 @@ import (
)
func abortWithError(w http.ResponseWriter, msg string) {
w.WriteHeader(500)
tmpl := template.Must(template.ParseGlob("components/*.html"))
tmpl.ExecuteTemplate(w, "error", msg)
}