frontend

package
v0.0.0-...-f3e09a6 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Templater = tmplutil.Templater{
	FileSystem: tmplutil.OverrideFS(webFS, os.DirFS("frontend")),
	Includes: map[string]string{
		"css":    "components/css.html",
		"error":  "components/error.html",
		"header": "components/header.html",
		"footer": "components/footer.html",
	},
	Functions: template.FuncMap{
		"RFC3339": func() string {
			return time.RFC3339
		},
		"RelTime": func(t time.Time) string {
			return humanize.Time(t)
		},
		"RelDurationShort": func(d time.Duration) string {
			return duration.Short(d)
		},
		"RelDurationLong": func(d time.Duration) string {
			return duration.Long(d)
		},
	},
	OnRenderFail: func(sub *tmplutil.Subtemplate, w io.Writer, err error) {
		sub.Templater().Execute(w, "error", err)
	},
}

Functions

func MountStatic

func MountStatic() http.Handler

MountStatic mounts the /static directory. Note that the returned handler will only handle /static paths, so it's safe to mount this to /static directly.

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