Documentation
¶
Overview ¶
Package html contains code relating specifically to the web UI.
Index ¶
- Constants
- func AddStaticHandler(r *mux.Router, devMode bool)
- func AssertRedirect(t *testing.T, w *httptest.ResponseRecorder, path string)
- func CurrentOrganization(content any) *string
- 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 ReturnUserOriginalPage(w http.ResponseWriter, r *http.Request)
- func SendUserToLoginPage(w http.ResponseWriter, r *http.Request)
- func SetCookie(w http.ResponseWriter, name, value string, expiry *time.Time)
- 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 AssertRedirect ¶ added in v0.0.33
func AssertRedirect(t *testing.T, w *httptest.ResponseRecorder, path string)
func CurrentOrganization ¶ added in v0.0.33
CurrentOrganization is a UI helper that is used to show the current organization on the web page.
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 ReturnUserOriginalPage ¶ added in v0.0.33
func ReturnUserOriginalPage(w http.ResponseWriter, r *http.Request)
ReturnUserOriginalPage returns a user to the original page they tried to access before they were redirected to the login page.
func SendUserToLoginPage ¶ added in v0.0.33
func SendUserToLoginPage(w http.ResponseWriter, r *http.Request)
SendUserToLoginPage sends user to the login prompt page, saving the original page they tried to access so it can return them there after login.
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)