Documentation ¶
Index ¶
- Variables
- type Merger
- type Page
- type PageConfig
- type PageOption
- func AppData(key string, value interface{}) 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 JavaScripts(urls ...string) PageOption
- func MetaName(key string, value string) PageOption
- func MetaProperty(key string, value string) PageOption
- func Stylesheets(urls ...string) PageOption
- func Template(str string) PageOption
- func Title(title string) PageOption
- type PageVars
- type PageVarsGenerator
- type PageVarsGeneratorFunc
Constants ¶
This section is empty.
Variables ¶
var DefaultPage = Must(New())
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
func New ¶
func New(options ...PageOption) (*Page, error)
type PageConfig ¶
type PageConfig struct { ReactModulePath string `json:"react_module_path"` 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 Favicon ¶
func Favicon(favicon string) PageOption
Faviconreturns 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 JavaScripts ¶
func JavaScripts(urls ...string) PageOption
JavasScripts returns a PageOption to add urls into the javascript list.
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 Stylesheets ¶
func Stylesheets(urls ...string) PageOption
Stylesheets returns a PageOption to add urls into the stylesheet list.
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 Body template.HTML MetaNames map[string]string MetaProperties map[string]string CSRFToken string ModulePath string Config *PageConfig AppData map[string]interface{} Auth interface{} Stylesheets []string Javascripts []string }
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