Exemplo n.º 1
0
func SetupPage(p *gos.Page, theme string) {
	if theme == "" {
		theme = gos.GetSite().SiteTheme
	}
	p.View.Theme = theme
	p.JsPosition = "end"

	// p.AddHead("<link href=\"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css\" rel=\"stylesheet\">")
	p.AddHead(`<meta name="viewport" content="width=device-width, initial-scale=1">`)
	p.AddCss(&gos.ThemeItem{Value: "bootstrap.min.css"})
	p.AddCss(&gos.ThemeItem{Value: "font-awesome.min.css"})

	p.AddCss(&gos.ThemeItem{Value: fmt.Sprint(p.View.Value, ".css"), Folder: fmt.Sprint(gos.RunMode, "/page/", p.View.Folder), Theme: theme})

	p.Layout.AddTopRender(gos.NewTemplateRender("", "", "_header", nil))
	// p.Layout.AddBottomRender(gos.NewTemplateRender("", "", "_footer", nil))

	p.Layout.RenderFunc = Render
	p.SetUserAuth(auth.New(p.Ctx))

	RequireJs(p)
	p.AddJs(&gos.ThemeItem{Value: "jquery.js"})
}
Exemplo n.º 2
0
func UserAuth(ctx *gos.Context) *auth.UserAuth {
	return auth.New(ctx)
}
Exemplo n.º 3
0
func (a *OpenApi) Prepare() bool {
	a.SetUserAuth(auth.New(a.WebApi.Ctx))
	return true
}