template

package
v0.0.0-...-e647751 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AdminFediAccountsForInstanceName = "admin_fedi_accounts_for_instance"

AdminFediAccountsForInstanceName is the name of the admin fedi accounts for instance template.

View Source
const AdminFediAccountsName = "admin_fedi_accounts"

AdminFediAccountsName is the name of the admin fedi accounts template.

View Source
const AdminFediInstancesName = "admin_fedi_instances"

AdminFediInstancesName is the name of the admin oauth clients template.

View Source
const AdminFediName = "admin_fedi"

AdminFediName is the name of the admin fedi template.

View Source
const AdminOauthClientAddName = "admin_oauth_client_add"

AdminOauthClientAddName is the name of the admin oauth clients template.

View Source
const AdminOauthClientAddedName = "admin_oauth_client_added"

AdminOauthClientAddedName is the name of the admin oauth added clients template.

View Source
const AdminOauthClientsName = "admin_oauth_clients"

AdminOauthClientsName is the name of the admin oauth clients template.

View Source
const AdminOauthName = "admin_oauth"

AdminOauthName is the name of the admin oauth template.

View Source
const AdminSystemApplicationTokenAddName = "admin_system_applicationtoken_add"

AdminSystemApplicationTokenAddName is the name of the admin system application add token template.

View Source
const AdminSystemApplicationTokenAddedName = "admin_system_applicationtoken_added"

AdminSystemApplicationTokenAddedName is the name of the admin system application token added template.

View Source
const AdminSystemApplicationTokensName = "admin_system_applicationtokens"

AdminSystemApplicationTokensName is the name of the admin system application tokens template.

View Source
const AdminSystemName = "admin_system"

AdminSystemName is the name of the admin oauth template.

View Source
const LoginName = "login"

LoginName is the name of the login template.

Variables

This section is empty.

Functions

func New

New creates a new template.

Types

type Admin

type Admin struct {
	Sidebar libtemplate.Sidebar
}

Admin contains the variables used in nearly every admin template.

type AdminFedi

type AdminFedi struct {
	Common
	Admin
}

AdminFedi contains the variables for the admin fedi 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 AdminOauth

type AdminOauth struct {
	Common
	Admin
}

AdminOauth contains the variables for the admin oauth template.

type AdminOauthClientAdd

type AdminOauthClientAdd struct {
	Common
	Admin

	FormInputDescription *libtemplate.FormInput
	FormInputRedirectURI *libtemplate.FormInput
	FormButtonSubmitText string
}

AdminOauthClientAdd contains the variables for the "admin_oauth_client" template.

type AdminOauthClientAdded

type AdminOauthClientAdded struct {
	Common
	Admin

	FormInputDescription  *libtemplate.FormInput
	FormInputClientID     *libtemplate.FormInput
	FormInputClientSecret *libtemplate.FormInput
	FormInputRedirectURI  *libtemplate.FormInput
}

AdminOauthClientAdded contains the variables for the "admin_oauth_client" template.

type AdminOauthClients

type AdminOauthClients struct {
	Common
	Admin

	HRefAddClient       string
	HRefViewClient      string
	HRefViewFediAccount string
	OauthClients        *[]*models.OauthClient
	Pagination          libtemplate.Pagination
}

AdminOauthClients contains the variables for the admin oauth clients template.

type AdminSystem

type AdminSystem struct {
	Common
	Admin
}

AdminSystem contains the variables for the admin oauth template.

type AdminSystemApplicationTokenAdd

type AdminSystemApplicationTokenAdd struct {
	Common
	Admin

	FormInputDescription *libtemplate.FormInput
	FormButtonSubmitText string
}

AdminSystemApplicationTokenAdd contains the variables for the admin system application add token template.

type AdminSystemApplicationTokenAdded

type AdminSystemApplicationTokenAdded struct {
	Common
	Admin

	FormInputDescription *libtemplate.FormInput
	FormInputToken       *libtemplate.FormInput
}

AdminSystemApplicationTokenAdded contains the variables for the admin system application token added template.

type AdminSystemApplicationTokens

type AdminSystemApplicationTokens struct {
	Common
	Admin

	HRefAddApplicationToken  string
	HRefViewApplicationToken string
	HRefViewFediAccount      string
	ApplicationTokens        *[]*models.ApplicationToken
	Pagination               libtemplate.Pagination
}

AdminSystemApplicationTokens contains the variables for the admin system application tokens template.

type Common

type Common struct {
	Language  string
	Localizer *language.Localizer

	Account *models.FediAccount

	Alerts        *[]libtemplate.Alert
	FooterScripts []libtemplate.Script
	HeadLinks     []libtemplate.HeadLink
	LogoSrcDark   string
	LogoSrcLight  string
	NavBar        Navbar
	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 (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

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) SetLogoSrc

func (t *Common) SetLogoSrc(dark, light string)

SetLogoSrc sets the src for the logo image.

func (*Common) SetNavbar

func (t *Common) SetNavbar(nodes Navbar)

SetNavbar sets the top level navbar used by the template.

type InitTemplate

type InitTemplate interface {
	AddHeadLink(l libtemplate.HeadLink)
	AddFooterScript(s libtemplate.Script)
	SetAccount(account *lmodels.FediAccount)
	SetLanguage(l string)
	SetLocalizer(l *language.Localizer)
	SetLogoSrc(dark, light string)
	SetNavbar(nodes Navbar)
}

InitTemplate are the functions a template implementing Common will have.

type Login

type Login struct {
	Common

	FormError   string
	FormAccount string
}

Login contains the variables for the "login" template.

type Navbar []NavbarNode

Navbar is a navbar that can be added to a page.

func (n *Navbar) ActivateFromPath(path string)

ActivateFromPath sets the active bool based on the match regex.

func (n *Navbar) GetChildren(i int) libtemplate.ActivableSlice

GetChildren returns the children of the node or nil if no children.

func (n *Navbar) GetMatcher(i int) *regexp.Regexp

GetMatcher returns the matcher of the node or nil if no matcher.

func (n *Navbar) Len() int

Len returns the matcher of the node or nil if no matcher.

func (n *Navbar) SetActive(i int, a bool)

SetActive sets the active bool based on the match regex.

type NavbarNode struct {
	Text     string
	URL      string
	MatchStr *regexp.Regexp
	FAIcon   string

	Active   bool
	Disabled bool

	Children Navbar
}

NavbarNode is an entry on a navbar, can be nested one level.

Jump to

Keyboard shortcuts

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