26 lines
623 B
Go
26 lines
623 B
Go
|
|
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")
|
||
|
|
)
|