`
type admin struct {
Logo string
Types map[string]func() interface{}
Subview template.HTML
}
// Admin ...
func Admin(view []byte) ([]byte, error) {
cfg, err := db.Config("name")
if err != nil {
return nil, err
}
if cfg == nil {
cfg = []byte("")
}
a := admin{
Logo: string(cfg),
Types: content.Types,
Subview: template.HTML(view),
}
buf := &bytes.Buffer{}
html := startAdminHTML + mainAdminHTML + endAdminHTML
tmpl := template.Must(template.New("admin").Parse(html))
err = tmpl.Execute(buf, a)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
var initAdminHTML = `
Welcome!
You need to initialize your system by filling out the form below. All of
this information can be updated later on, but you will not be able to start
without first completing this step.