web

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LayoutTemplateFiles = []string{
	"_layout/layout.html",
	"_layout/header.html",
	"_layout/footer.html",
}

Functions

func BuildPageHeader added in v0.0.4

func BuildPageHeader() (string, error)

func CompileTimeCheck

func CompileTimeCheck(fsys fs.FS) error

func GetTemplate

func GetTemplate(files ...string) *template.Template

func GetTemplateNames

func GetTemplateNames() []string

func HandleNotFound

func HandleNotFound(w http.ResponseWriter, r *http.Request)

func HandlePageError

func HandlePageError(w http.ResponseWriter, r *http.Request, pageError error)

func HandleTemplateError

func HandleTemplateError(w http.ResponseWriter, r *http.Request, fileIdentifier, functionIdentifier, infoIdentifier string, err error) error

used to handle errors constructed by Template.ExecuteTemplate correctly

Types

type ErrorPageData

type ErrorPageData struct {
	CallTime   time.Time
	CallURL    string
	ErrorMsg   string
	StackTrace string
	Version    string
}

type Frontend

type Frontend struct {
	NotFoundHandler func(http.ResponseWriter, *http.Request)
	// contains filtered or unexported fields
}

func NewFrontend

func NewFrontend(config *types.FrontendConfig) (*Frontend, error)

func (*Frontend) ServeHTTP

func (frontend *Frontend) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Meta

type Meta struct {
	Title       string
	Description string
	Domain      string
	Path        string
	Tlabel1     string
	Tdata1      string
	Tlabel2     string
	Tdata2      string
	Templates   string
}

type PageData

type PageData struct {
	Active         string
	Meta           *Meta
	ShowSidebar    bool
	SidebarData    interface{}
	Data           interface{}
	Version        string
	Year           int
	Title          string
	Lang           string
	Debug          bool
	DebugTemplates []string
}

func InitPageData

func InitPageData(r *http.Request, active, path, title string, mainTemplates []string) *PageData

Directories

Path Synopsis
api
docs
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

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