Documentation ¶
Overview ¶
Package viewutil provides utilities and common templates for views across all packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( BaseEn *template.Template BaseRu *template.Template )
var HeaderLinks []HeaderLink
HeaderLinks is a list off current header links. Feel free to iterate it directly but do not modify it by yourself. Call ParseHeaderLinks if you need to set new header links.
Functions ¶
func Base ¶
func Base(meta Meta, title, body string, bodyAttributes map[string]string, headElements ...string) string
Base is a temporary wrapper around BaseEn and BaseRu, meant to facilitate the migration from qtpl. TODO: get rid of this
func ExecutePage ¶
func ExecutePage(meta Meta, chain Chain, data interface { withBaseValues(meta Meta, headerLinks []HeaderLink, commonScripts []string) })
ExecutePage executes template page in the given chain with the given data that has BaseData nested. It also sets some common BaseData fields
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents a chain of different language versions of the same template.
type HeaderLink ¶ added in v1.11.0
type HeaderLink struct { // Href is the URL of the link. It goes <a href="here">...</a>. Href string // Display is what is shown when the link is rendered. It goes <a href="...">here</a>. Display string }
HeaderLink represents a header link. Header links are the links shown in the top gray bar.