views

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPHandlerFuncErr

func HTTPHandlerFuncErr(handler func(w http.ResponseWriter, r *http.Request) error) http.HandlerFunc

func Render

func Render[D any](w io.Writer, name string, data Model[D]) error

func RenderChangePasswordPage

func RenderChangePasswordPage(w io.Writer, data Model[ChangePasswordPageViewModel]) error

func RenderErrorPage

func RenderErrorPage(w http.ResponseWriter, r *http.Request, err error)

func RenderLoginPage

func RenderLoginPage(w io.Writer, data Model[LoginPageViewModel]) error

Types

type ChangePasswordPageViewModel

type ChangePasswordPageViewModel struct {
	ValidationErrs map[string]string
}

type DocumentViewModel

type DocumentViewModel struct {
	Global Global
	Body   string
	Data   any
}

type ErrorPageErr

type ErrorPageErr struct {
	Code    int
	Title   string
	Message string
	// contains filtered or unexported fields
}

type Global

type Global struct {
	Title              string
	CSRFToken          string
	FlashMessage       string
	Search             string
	CurrentPage        string
	SidebarClosed      bool
	CurrentUserIsAdmin bool
	Version            string
}

func NewGlobal

func NewGlobal(title string, r *http.Request) Global

type LoginPageViewModel

type LoginPageViewModel struct {
	ValidationErrs map[string]string
}

type Model

type Model[D any] struct {
	Global Global
	Data   D
}

Jump to

Keyboard shortcuts

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