Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
UserContextKey = contextKey("user")
)
Functions ¶
func FuncMap ¶
FuncMap some function that can be used in templates
Types ¶
type AppContext ¶
type AppContext struct { SessionService *session.SessionService ArticleService models.ArticleService CategoryService models.CategoryService UserService models.UserService UserInviteService models.UserInviteService SiteService models.SiteService FileService models.FileService TokenService models.TokenService Mailer models.Mailer ConfigService *settings.Settings Templates *template.Template }
AppContext contains the services, session store, templates, ...
type Handler ¶
type Handler func(*AppContext, http.ResponseWriter, *http.Request) *Template
Handler enriches handler with the AppContext
type JHandler ¶
type JHandler func(*AppContext, http.ResponseWriter, *http.Request) (*models.JSONData, error)
JHandler enriches handler with the AppContext
type JSONHandler ¶
type JSONHandler struct { AppCtx *AppContext Handler JHandler }
JSONHandler marshals JSON and writes to the http response
func (JSONHandler) ServeHTTP ¶
func (fn JSONHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type Template ¶
type Template struct { Name string Active string Data map[string]interface{} SuccessMsg string WarnMsg string RedirectPath string Err error }
Template contains the information about the template to render. The DisplayMsg in models.Error will be the ErrorMsg in the flash bubble, the SuccessMsg is an optional variable which is also displayed as a green flash bubble, both are appended to the data map with keys 'ErrorMsg' or 'SuccessMsg' in the AppHandler
func NotFound ¶
func NotFound(ctx *AppContext, rw http.ResponseWriter, r *http.Request) *Template
NotFound returned if no route matches
type TemplateHandler ¶
type TemplateHandler struct { AppCtx *AppContext Handler Handler }
TemplateHandler enriches handlers with a application context containing 'services'
func (TemplateHandler) ServeHTTP ¶
func (fn TemplateHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type Templates ¶
Templates defines in which directory should be looked for template
type XHandler ¶
type XHandler func(*AppContext, http.ResponseWriter, *http.Request) (*models.XMLData, error)
XNLHandler enriches handler with the AppContext
type XMLHandler ¶
type XMLHandler struct { AppCtx *AppContext Handler XHandler }
XMLHandler marshals XML and writes to the http response
func (XMLHandler) ServeHTTP ¶
func (fn XMLHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)