Ejemplo n.º 1
0
func (this *HTMLHeadMiddleWare) Body(ctxt *web.Context) {
	head := &HTMLHead{
		cssbatch:    this.cssbatch,
		scriptbatch: this.scriptbatch,
		css:         make([]string, 0, 1),
		scripts:     make([]string, 0, 1),
		addedcss:    make([]string, 0, 1),
		addedscript: make([]string, 0, 1),
	}
	ctxt.SetResource("htmlhead", head)
	ctxt.SetTitle_ = head.SetTitle

	if this.defaultTitle != "" {
		head.SetTitle(this.defaultTitle)
	}
	if this.defaultCss != nil && len(this.defaultCss) > 0 {
		head.AddCss(this.defaultCss...)
	}
	if this.defaultScripts != nil && len(this.defaultScripts) > 0 {
		head.AddScript(this.defaultScripts...)
	}
}