html

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package html contains code relating specifically to the web UI.

Index

Constants

View Source
const (
	FlashSuccessType flashType = "success"
	FlashWarningType flashType = "warning"
	FlashErrorType   flashType = "error"
)

Variables

This section is empty.

Functions

func AddStaticHandler added in v0.0.32

func AddStaticHandler(r *mux.Router, devMode bool)

AddStaticHandler adds a handler to router serving static assets (JS, CSS, etc) from within go binary. Dev mode sources files from local disk instead.

func Error added in v0.0.27

func Error(w http.ResponseWriter, err string, code int)

func FlashError

func FlashError(w http.ResponseWriter, msg string)

FlashError helper writes a single flash error message

func FlashSuccess

func FlashSuccess(w http.ResponseWriter, msg string)

FlashSuccess helper writes a single flash success message

func FlashWarning added in v0.0.31

func FlashWarning(w http.ResponseWriter, msg string)

FlashWarning helper writes a single flash warning message

func MarkdownToHTML added in v0.0.32

func MarkdownToHTML(md []byte) template.HTML

func NewViewEngine added in v0.0.27

func NewViewEngine(devmode bool) (*viewEngine, error)

func PopFlashes added in v0.0.31

func PopFlashes(w http.ResponseWriter, r *http.Request) ([]flash, error)

PopFlashes pops all flash messages off the stack

func SetCookie added in v0.0.32

func SetCookie(w http.ResponseWriter, name, value string, expiry *time.Time)

SetCookie sets a cookie on the http response. A nil expiry sets no expiry, and a zero expiry sets it to be purged from the browser.

func SetOrganization added in v0.0.32

func SetOrganization(next http.Handler) http.Handler

SetOrganization ensures the session's organization reflects the most recently visited organization route.

func UIRouter added in v0.0.32

func UIRouter(r *mux.Router) *mux.Router

UIRouter wraps the given router with a router suitable for web UI routes.

Types

type FlashStack added in v0.0.32

type FlashStack []flash

FlashStack is a stack of flash messages

func (*FlashStack) Push added in v0.0.32

func (s *FlashStack) Push(t flashType, msg string)

func (FlashStack) Write added in v0.0.32

func (s FlashStack) Write(w http.ResponseWriter)

Directories

Path Synopsis
Package paths provides rails-style path helpers for use with the web app.
Package paths provides rails-style path helpers for use with the web app.

Jump to

Keyboard shortcuts

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