Documentation
¶
Overview ¶
Package html contains code relating specifically to the web UI.
Index ¶
- Constants
- func AddStaticHandler(r *mux.Router, devMode bool)
- func Error(w http.ResponseWriter, err string, code int)
- func FlashError(w http.ResponseWriter, msg string)
- func FlashSuccess(w http.ResponseWriter, msg string)
- func FlashWarning(w http.ResponseWriter, msg string)
- func MarkdownToHTML(md []byte) template.HTML
- func NewViewEngine(devmode bool) (*viewEngine, error)
- func PopFlashes(w http.ResponseWriter, r *http.Request) ([]flash, error)
- func SetCookie(w http.ResponseWriter, name, value string, expiry *time.Time)
- func SetOrganization(next http.Handler) http.Handler
- func UIRouter(r *mux.Router) *mux.Router
- type FlashStack
Constants ¶
const ( FlashSuccessType flashType = "success" FlashWarningType flashType = "warning" FlashErrorType flashType = "error" )
Variables ¶
This section is empty.
Functions ¶
func AddStaticHandler ¶ added in v0.0.32
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 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 NewViewEngine ¶ added in v0.0.27
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
SetOrganization ensures the session's organization reflects the most recently visited organization route.
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)