frontend

package
v0.0.0-...-f06591a Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Template = tmplutil.Templater{
	FileSystem: baseFS,
	Includes: map[string]string{
		"styles": "components/styles.html",
		"error":  "components/error.html",
	},
	Functions: template.FuncMap{
		"Plural":  Plural,
		"ToLower": strings.ToLower,
		"ToUpper": strings.ToUpper,
	},
	OnRenderFail: func(sub *tmplutil.Subtemplate, w io.Writer, err error) {
		Template := sub.Templater()
		Template.Subtemplate("error").Execute(w, err)
	},
}

Functions

func ErrorHTML

func ErrorHTML(w http.ResponseWriter, code int, err error)

ErrorHTML writes the error as HTML into w.

func OverrideTmpl

func OverrideTmpl(path string)

OverrideTmpl overrides templates using the given path.

func Plural

func Plural(n int, singular, plural string) string

Plural returns "($singular | $plural)" depending on n.

func Preload

func Preload()

func StaticHandler

func StaticHandler() http.Handler

StaticHandler returns a handler serving files in static/.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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