Feat: add error template
This commit is contained in:
9
components/error.html
Normal file
9
components/error.html
Normal 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}}
|
@ -2,7 +2,8 @@
|
|||||||
<div class="flex h-screen">
|
<div class="flex h-screen">
|
||||||
<!-- Left Panel -->
|
<!-- Left Panel -->
|
||||||
{{template "teampew" "blue"}}
|
{{template "teampew" "blue"}}
|
||||||
|
{{template "cardtable" .}}
|
||||||
<!-- Right Panel -->
|
<!-- Right Panel -->
|
||||||
{{template "cardtable" "red"}}
|
{{template "teampew" "red"}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func abortWithError(w http.ResponseWriter, msg string) {
|
func abortWithError(w http.ResponseWriter, msg string) {
|
||||||
|
w.WriteHeader(500)
|
||||||
tmpl := template.Must(template.ParseGlob("components/*.html"))
|
tmpl := template.Must(template.ParseGlob("components/*.html"))
|
||||||
tmpl.ExecuteTemplate(w, "error", msg)
|
tmpl.ExecuteTemplate(w, "error", msg)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user