template

package
v0.0.0-...-0f594a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AdminInstanceName = "admin_instance"

AdminInstanceName is the name of the admin block list template.

View Source
const AdminTagsName = "admin_tags"

AdminTagsName is the name of the admin tags list template.

View Source
const ErrorName = "error"

ErrorPageName is the name of the error template.

View Source
const HomeName = "home"

HomeName is the name of the home template.

Variables

This section is empty.

Functions

func New

func New(tokz *token.Tokenizer) (*template.Template, error)

New creates a new template.

Types

type AdminInstance

type AdminInstance struct {
	Common

	Instances  []*models.Instance
	Pagination libtemplate.Pagination

	FormAddError            *libtemplate.Alert
	FormAddAction           libtemplate.FormInput
	FormAddDomain           libtemplate.FormInput
	FormAddObfuscatedDomain libtemplate.FormInput
	FormAddForce            libtemplate.FormInput
}

AdminInstance contains the variables for the admin block list template.

type AdminTags

type AdminTags struct {
	Common

	Tags       []*models.Tag
	Pagination libtemplate.Pagination

	FormAddError       *libtemplate.Alert
	FormAddAction      libtemplate.FormInput
	FormAddName        libtemplate.FormInput
	FormAddDescription libtemplate.FormTextarea
}

AdminTags contains the variables for the admin tags list template.

type Common

type Common struct {
	Language  string
	Localizer *language.Localizer

	Account *models.Account

	Alerts            *[]libtemplate.Alert
	FooterScripts     []libtemplate.Script
	FooterExtraScript []string
	HeadLinks         []libtemplate.HeadLink

	NavBar     libtemplate.Navbar
	NavBarDark bool
	PageTitle  string
}

Common contains the variables used in nearly every template.

func (*Common) AddFooterExtraScript

func (t *Common) AddFooterExtraScript(s string)

AddFooterExtraScript adds a footer script to the template.

func (*Common) AddFooterScript

func (t *Common) AddFooterScript(s libtemplate.Script)

AddFooterScript adds a footer script to the template.

func (t *Common) AddHeadLink(l libtemplate.HeadLink)

AddHeadLink adds a headder link to the template.

func (*Common) SetAccount

func (t *Common) SetAccount(account *models.Account)

SetAccount sets the currently logged-in account.

func (*Common) SetLanguage

func (t *Common) SetLanguage(l string)

SetLanguage sets the template's default language.

func (*Common) SetLocalizer

func (t *Common) SetLocalizer(l *language.Localizer)

SetLocalizer sets the localizer the template will use to generate text.

func (*Common) SetNavbar

func (t *Common) SetNavbar(nodes libtemplate.Navbar)

SetNavbar sets the top level navbar used by the template.

func (*Common) SetNavbarDark

func (t *Common) SetNavbarDark(dark bool)

SetNavbarDark sets the navbar theme.

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 Home

type Home struct {
	Common
}

Home contains the variables for the home template.

type InitTemplate

type InitTemplate interface {
	AddHeadLink(l libtemplate.HeadLink)
	AddFooterScript(s libtemplate.Script)
	SetAccount(account *models.Account)
	SetLanguage(l string)
	SetLocalizer(l *language.Localizer)
	SetNavbar(nodes libtemplate.Navbar)
	SetNavbarDark(dark bool)
}

InitTemplate are the functions a template implementing Common will have.

type Login

type Login struct {
	libtemplate.Login
}

func (*Login) AddFooterExtraScript

func (t *Login) AddFooterExtraScript(s string)

AddFooterExtraScript adds a footer script to the template.

func (*Login) AddFooterScript

func (t *Login) AddFooterScript(s libtemplate.Script)

AddFooterScript adds a footer script to the template.

func (t *Login) AddHeadLink(l libtemplate.HeadLink)

AddHeadLink adds a headder link to the template.

func (*Login) SetAccount

func (t *Login) SetAccount(account *models.Account)

SetAccount sets the currently logged-in account.

func (*Login) SetLanguage

func (t *Login) SetLanguage(l string)

SetLanguage sets the template's default language.

func (*Login) SetLocalizer

func (t *Login) SetLocalizer(l *language.Localizer)

SetLocalizer sets the localizer the template will use to generate text.

func (*Login) SetNavbar

func (t *Login) SetNavbar(nodes libtemplate.Navbar)

SetNavbar sets the top level navbar used by the template.

func (*Login) SetNavbarDark

func (t *Login) SetNavbarDark(dark bool)

SetNavbarDark sets the navbar theme.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL