// Package admin desrcibes the admin view containing references to
// various managers and editors
package admin
import (
"bytes"
"html/template"
"github.com/nilslice/cms/content"
)
const adminHTML = `
CMS
{{ range $t, $f := .Types }}
- {{ $t }}
{{ end }}
{{ if .Subview}}
{{ .Subview }}
{{ end }}
`
type admin struct {
Types map[string]func() interface{}
Subview template.HTML
}
// Admin ...
func Admin(manager []byte) []byte {
a := admin{
Types: content.Types,
Subview: template.HTML(manager),
}
buf := &bytes.Buffer{}
tmpl := template.Must(template.New("admin").Parse(adminHTML))
tmpl.Execute(buf, a)
return buf.Bytes()
}