hsa-app/internal/web/templates.go

28 lines
702 B
Go
Raw Normal View History

package web
import (
"embed"
"html/template"
)
//go:embed templates/*.html
var templatesFS embed.FS
//go:embed static/*
var staticFS embed.FS
// parsePage parses the shared base layout together with a single page template,
// yielding a template set whose "base" definition renders the full document.
func parsePage(name string) *template.Template {
return template.Must(template.ParseFS(templatesFS, "templates/base.html", "templates/"+name))
}
var (
uploadPage = parsePage("upload.html")
confirmPage = parsePage("confirm.html")
managePage = parsePage("manage.html")
exportPage = parsePage("export.html")
tallyPage = parsePage("tally.html")
recentPage = parsePage("recent.html")
)