Documentation ¶
Index ¶
- type Merger
- type Page
- type PageConfig
- type PageOption
- func AppData(key string, value interface{}) PageOption
- func BasePath(basePath string) PageOption
- func Body(b []byte) PageOption
- func Config(c *PageConfig) PageOption
- func Favicon(favicon string) PageOption
- func GeneratorFunc(f func(req *web.Request) (*PageVars, error)) PageOption
- func MetaName(key string, value string) PageOption
- func MetaProperty(key string, value string) PageOption
- func Template(str string) PageOption
- func Title(title string) PageOption
- type PageVars
- type PageVarsGenerator
- type PageVarsGeneratorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page is a view.Page implementation for react applications. The fields in this object is used as a default values of PageVars
type PageConfig ¶
type PageConfig struct { AuthAPIBasePath string `json:"auth_api_base_path"` FacebookAppID string `json:"facebook_app_id"` FacebookPageID string `json:"facebook_page_id"` FacebookPixelID string `json:"facebook_pixel_id"` GoogleAnalyticsID string `json:"google_analytics_id"` TwitterID string `json:"twitter_id"` InstagramID string `json:"instagram_id"` }
Config represents the built-in data items used in react pages configurations
func (*PageConfig) Merge ¶
func (c *PageConfig) Merge(obj interface{}) interface{}
type PageOption ¶
func AppData ¶
func AppData(key string, value interface{}) PageOption
AppData returns a PageOption to set the AppData field.
func BasePath ¶
func BasePath(basePath string) PageOption
BasePath returns a PageOption to set the reactapp base path. App js file would be loaded from {basePath}/{appName}/static/js/main.js
func Favicon ¶
func Favicon(favicon string) PageOption
Favicon returns a PageOption to set the favicon path
func GeneratorFunc ¶
func GeneratorFunc(f func(req *web.Request) (*PageVars, error)) PageOption
GeneratorFunc returns a PageOption to set a *PageVar generator function
func MetaName ¶
func MetaName(key string, value string) PageOption
MetaName returns a PageOption to set the meta name.
func MetaProperty ¶
func MetaProperty(key string, value string) PageOption
MetaProperty returns a PageOption to set the meta props.
func Template ¶
func Template(str string) PageOption
Template returns a PageOption to overwrite the default template
type PageVars ¶
type PageVars struct { Status response.HTTPStatus Title string CanonicalURL string Favicon string BasePath string Body template.HTML MetaNames map[string]string MetaProperties map[string]string CSRFToken string Config *PageConfig AppName string AppData map[string]interface{} Auth interface{} }
PageVars is a page data generated per an http request from a Page object.
func Status ¶
func Status(s response.HTTPStatus) *PageVars
Status returns a blank *PageVars with a status code
type PageVarsGenerator ¶
PageVarsGenerator is an interface to generate a *PageVars
type PageVarsGeneratorFunc ¶
PageVarsGeneratorFunc is a func to ConfigGenerator conversion