Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Templates *template.Template
Templates contain the pre-processed templates
Functions ¶
func MakeNavbar ¶
func MakeNavbar(r *http.Request, newNavbar []*NavbarNode)
MakeNavbar sets the active attribute based on the request url
Types ¶
type Common ¶
type Common struct { Language string Localizer *language.Localizer HeadLinks []HeadLink PageTitle string User *models.User }
Common contains the variables used in nearly every template
func (*Common) AddFooterScript ¶
AddFooterScript adds a footer script to the template
func (*Common) AddHeadLink ¶
AddHeadLink adds a headder link to the template
func (*Common) SetLanguage ¶
SetLanguage sets the template's default language
func (*Common) SetLocalizer ¶
SetLocalizer sets the localizer the template will use to generate text
func (*Common) SetNavbar ¶
func (t *Common) SetNavbar(nodes []*NavbarNode)
SetNavbar sets the top level navbar used by the template
type HeadLink ¶
type HeadLink struct { HRef string Rel string Integrity string CrossOrigin string Sizes string Type string }
HeadLink is the data for a header link
type HomeTemplate ¶
type HomeTemplate struct {
Common
}
HomeTemplate contains the variables for the "home" template.
type InitTemplate ¶
type InitTemplate interface { AddHeadLink(l HeadLink) SetLanguage(l string) SetLocalizer(l *language.Localizer) SetUser(user *models.User) }
InitTemplate are the functions a template implementing Common will have
type LoginTemplate ¶
type LoginTemplate struct { Common BotImage string FormError string FormEmail string FormPassword string }
LoginTemplate contains the variables for the "login" template.
type NavbarNode ¶
type NavbarNode struct {}
NavbarNode is an entry on a navbar, can be nested one level