2220968a by astaxie

Merge pull request #347 from odiel/master

Adding template functions to generate JS and CSS tags
2 parents 8cf34fce 16114762
...@@ -34,6 +34,8 @@ func init() { ...@@ -34,6 +34,8 @@ func init() {
34 beegoTplFuncMap["htmlquote"] = Htmlquote 34 beegoTplFuncMap["htmlquote"] = Htmlquote
35 beegoTplFuncMap["htmlunquote"] = Htmlunquote 35 beegoTplFuncMap["htmlunquote"] = Htmlunquote
36 beegoTplFuncMap["renderform"] = RenderForm 36 beegoTplFuncMap["renderform"] = RenderForm
37 beegoTplFuncMap["assets_js"] = AssetsJs
38 beegoTplFuncMap["assets_css"] = AssetsCss
37 39
38 // go1.2 added template funcs 40 // go1.2 added template funcs
39 // Comparisons 41 // Comparisons
......
...@@ -388,3 +388,22 @@ func GetRandomString(n int) string { ...@@ -388,3 +388,22 @@ func GetRandomString(n int) string {
388 func UrlFor(endpoint string, values ...string) string { 388 func UrlFor(endpoint string, values ...string) string {
389 return BeeApp.UrlFor(endpoint, values...) 389 return BeeApp.UrlFor(endpoint, values...)
390 } 390 }
391
392
393 //This can be changed to a better name
394 func AssetsJs(src string) template.HTML {
395 text := string(src)
396
397 text = "<script src=\""+src+"\"></script>"
398
399 return template.HTML(text)
400 }
401
402 //This can be changed to a better name
403 func AssetsCss(src string) template.HTML {
404 text := string(src)
405
406 text = "<link href=\""+src+"\" rel=\"stylesheet\" />"
407
408 return template.HTML(text)
409 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!