Use esc to embed static assets
This commit is contained in:
16
tmpl.go
16
tmpl.go
@@ -7,11 +7,19 @@ import (
|
||||
)
|
||||
|
||||
func displayTmpl(w http.ResponseWriter, page string, vars map[string]interface{}) {
|
||||
if t, err := template.ParseGlob(path.Join(StaticDir, "*.html")); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
t.ExecuteTemplate(w, page, vars)
|
||||
t := template.New("index")
|
||||
for _, fname := range []string{
|
||||
"/static/change.html",
|
||||
"/static/footer.html",
|
||||
"/static/header.html",
|
||||
"/static/login.html",
|
||||
"/static/lost.html",
|
||||
"/static/message.html",
|
||||
"/static/reset.html",
|
||||
} {
|
||||
t.New(path.Base(fname)).Parse(FSMustString(false, fname))
|
||||
}
|
||||
t.ExecuteTemplate(w, page, vars)
|
||||
}
|
||||
|
||||
func displayTmplError(w http.ResponseWriter, statusCode int, page string, vars map[string]interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user