templates

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = template.Must(
	template.ParseFS(Files,
		"error/error.html",
	))
View Source
var Files embed.FS
View Source
var Layouts = template.Must(
	base().ParseFS(Files,
		"layout/*.html",
	),
)

Functions

func App added in v0.0.16

func App(name string) *template.Template

func Avatar

func Avatar(uid string, size uint, class ...string) template.HTML

func Email added in v0.0.16

func Email(name string) *template.Template

func Focus added in v0.0.16

func Focus(name string) *template.Template

func JSON added in v0.0.17

func JSON(a any) (string, error)

func LogoText added in v0.0.13

func LogoText(size int, class ...string) template.HTML

func Must added in v0.0.16

func Must(name, layout_ string) *template.Template

func SetCSRF

func SetCSRF(ctx context.Context, x template.HTML) context.Context

func SetCaptcha

func SetCaptcha(ctx context.Context, x template.HTMLAttr) context.Context

Types

type Context

type Context struct {
	Title     string
	Header    Header
	USER      *models.User
	Data      map[string]any
	CSRF      template.HTML
	Captcha   template.HTMLAttr
	Errors    map[string]string
	Form      url.Values
	Code      uint64
	ResetLink string
	Token     string
	Email     string
	Config    *config.Options
	HasPin    bool
	Flash     *flash.Flash
	Error     *Errors
	Site      *models.Site
	Recipient string
	Overview  *Overview
	Stats     *SiteStats
}

func New

func New(ctx context.Context, f ...func(c *Context)) *Context

func (*Context) GreetRecipient

func (t *Context) GreetRecipient() string

func (*Context) Home added in v0.0.13

func (t *Context) Home() string

func (*Context) ProfileOverview added in v0.0.13

func (t *Context) ProfileOverview() string

func (*Context) ProfileSites added in v0.0.13

func (t *Context) ProfileSites() string

type Errors

type Errors struct {
	Status     int
	StatusText string
}
type Header struct {
	Context    string
	Mode       string
	ContextRef string
}

type Metric added in v0.0.15

type Metric struct {
	Name     string
	Query    string
	Selected bool
	Value    uint64
}

func (*Metric) Select added in v0.0.15

func (m *Metric) Select() string

type Overview added in v0.0.13

type Overview struct {
	Global spec.Global[spec.Metrics]
	Sites  []SiteOverView
	Panel  string
}

type Period added in v0.0.15

type Period struct {
	Name     string
	Selected bool
	Query    string
}

type SiteOverView added in v0.0.13

type SiteOverView struct {
	Site   *models.Site
	Owner  string
	Global spec.Global[spec.Metrics]
}

type SiteStats added in v0.0.15

type SiteStats struct {
	Site   *models.Site
	Owner  string
	Metric spec.Metric
	Window timex.Duration
	Global spec.Global[spec.Metrics]
	Series spec.Series[[]uint64]
}

func (*SiteStats) Metrics added in v0.0.15

func (s *SiteStats) Metrics() []Metric

func (*SiteStats) Periods added in v0.0.15

func (s *SiteStats) Periods() []Period

Jump to

Keyboard shortcuts

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