mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 23:00:55 +00:00
Merge pull request #347 from odiel/master
Adding template functions to generate JS and CSS tags
This commit is contained in:
commit
2220968a01
@ -34,6 +34,8 @@ func init() {
|
|||||||
beegoTplFuncMap["htmlquote"] = Htmlquote
|
beegoTplFuncMap["htmlquote"] = Htmlquote
|
||||||
beegoTplFuncMap["htmlunquote"] = Htmlunquote
|
beegoTplFuncMap["htmlunquote"] = Htmlunquote
|
||||||
beegoTplFuncMap["renderform"] = RenderForm
|
beegoTplFuncMap["renderform"] = RenderForm
|
||||||
|
beegoTplFuncMap["assets_js"] = AssetsJs
|
||||||
|
beegoTplFuncMap["assets_css"] = AssetsCss
|
||||||
|
|
||||||
// go1.2 added template funcs
|
// go1.2 added template funcs
|
||||||
// Comparisons
|
// Comparisons
|
||||||
|
19
utils.go
19
utils.go
@ -388,3 +388,22 @@ func GetRandomString(n int) string {
|
|||||||
func UrlFor(endpoint string, values ...string) string {
|
func UrlFor(endpoint string, values ...string) string {
|
||||||
return BeeApp.UrlFor(endpoint, values...)
|
return BeeApp.UrlFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//This can be changed to a better name
|
||||||
|
func AssetsJs(src string) template.HTML {
|
||||||
|
text := string(src)
|
||||||
|
|
||||||
|
text = "<script src=\""+src+"\"></script>"
|
||||||
|
|
||||||
|
return template.HTML(text)
|
||||||
|
}
|
||||||
|
|
||||||
|
//This can be changed to a better name
|
||||||
|
func AssetsCss(src string) template.HTML {
|
||||||
|
text := string(src)
|
||||||
|
|
||||||
|
text = "<link href=\""+src+"\" rel=\"stylesheet\" />"
|
||||||
|
|
||||||
|
return template.HTML(text)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user