Documentation
¶
Index ¶
- Constants
- func New(t *token.Tokenizer) (*template.Template, error)
- type Admin
- type AdminFedi
- type AdminFediAccounts
- type AdminFediAccountsForInstance
- type AdminFediInstances
- type Common
- func (t *Common) AddFooterScript(s libtemplate.Script)
- func (t *Common) AddHeadLink(l libtemplate.HeadLink)
- func (t *Common) SetAccount(account *models.FediAccount)
- func (t *Common) SetLanguage(l string)
- func (t *Common) SetLocalizer(l *language.Localizer)
- func (t *Common) SetLogoSrc(dark, light string)
- func (t *Common) SetNavbar(nodes Navbar)
- type Error
- type Home
- type InitTemplate
- type Login
- type Navbar
- type NavbarNode
Constants ¶
const AdminFediAccountsForInstanceName = "admin_fedi_accounts_for_instance"
AdminFediAccountsForInstanceName is the name of the admin fedi accounts for instance template.
const AdminFediAccountsName = "admin_fedi_accounts"
AdminFediAccountsName is the name of the admin fedi accounts template.
const AdminFediInstancesName = "admin_fedi_instances"
AdminFediInstancesName is the name of the admin oauth clients template.
const AdminFediName = "admin_fedi"
AdminFediName is the name of the admin fedi template.
const ErrorName = "error"
ErrorPageName is the name of the error template.
const HomeName = "home"
HomeName is the name of the home template.
const LoginName = "login"
LoginName is the name of the login template.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Admin ¶
type Admin struct {
Sidebar libtemplate.Sidebar
}
Admin contains the variables used in nearly every admin template.
type AdminFediAccounts ¶
type AdminFediAccounts struct {
Common
Admin
HRefViewFediAccount string
HRefViewFediInstance string
FediAccounts *[]*models.FediAccount
Pagination libtemplate.Pagination
}
AdminFediAccounts contains the variables for the fedi instances template.
type AdminFediAccountsForInstance ¶
type AdminFediAccountsForInstance struct {
Common
Admin
HRefViewFediAccount string
HRefViewFediInstance string
FediInstance *models.FediInstance
FediAccounts *[]*models.FediAccount
Pagination libtemplate.Pagination
}
AdminFediAccountsForInstance contains the variables for the fedi instances template.
type AdminFediInstances ¶
type AdminFediInstances struct {
Common
Admin
HRefViewFediInstance string
FediInstances *[]*models.FediInstance
FediInstanceAccountCounts []int64
Pagination libtemplate.Pagination
}
AdminFediInstances contains the variables for the fedi instances template.
type Common ¶
type Common struct {
Language string
Localizer *language.Localizer
Account *models.FediAccount
Alerts *[]libtemplate.Alert
HeadLinks []libtemplate.HeadLink
LogoSrcDark string
LogoSrcLight string
PageTitle string
}
Common contains the variables used in nearly every template.
func (*Common) AddFooterScript ¶
func (t *Common) AddFooterScript(s libtemplate.Script)
AddFooterScript adds a footer script to the template.
func (*Common) AddHeadLink ¶
func (t *Common) AddHeadLink(l libtemplate.HeadLink)
AddHeadLink adds a headder link to the template.
func (*Common) SetAccount ¶
func (t *Common) SetAccount(account *models.FediAccount)
SetAccount sets the currently logged-in account.
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) SetLogoSrc ¶
SetLogoSrc sets the src for the logo image.
type Error ¶
type Error struct {
Common
Header string
Image string
SubHeader string
Paragraph string
ButtonHRef string
ButtonLabel string
}
Error contains the variables for the error template.
type InitTemplate ¶
type InitTemplate interface {
AddHeadLink(l libtemplate.HeadLink)
SetAccount(account *models.FediAccount)
SetLanguage(l string)
SetLocalizer(l *language.Localizer)
SetLogoSrc(dark, light string)
}
InitTemplate are the functions a template implementing Common will have.
type Navbar ¶
type Navbar []NavbarNode
Navbar is a navbar that can be added to a page.
func (*Navbar) ActivateFromPath ¶
ActivateFromPath sets the active bool based on the match regex.
func (*Navbar) GetChildren ¶
func (n *Navbar) GetChildren(i int) libtemplate.ActivableSlice
GetChildren returns the children of the node or nil if no children.
func (*Navbar) GetMatcher ¶
GetMatcher returns the matcher of the node or nil if no matcher.
type NavbarNode ¶
type NavbarNode struct {
}
NavbarNode is an entry on a navbar, can be nested one level.