1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 20:40:50 +00:00

Update utils.go

Adding Assets functions for the template, to generate HTML tags for JS and CSS
This commit is contained in:
odiel 2013-12-06 10:36:12 -05:00
parent 8cf34fce98
commit 0bdd400fe7

View File

@ -388,3 +388,22 @@ func GetRandomString(n int) string {
func UrlFor(endpoint string, values ...string) string {
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)
}