summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/templates/dynamic.go12
-rw-r--r--modules/templates/static.go9
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/templates/dynamic.go b/modules/templates/dynamic.go
index d70a465c1c..dbd75221d2 100644
--- a/modules/templates/dynamic.go
+++ b/modules/templates/dynamic.go
@@ -45,6 +45,18 @@ func JSONRenderer() macaron.Handler {
})
}
+// JSRenderer implements the macaron handler for serving JS templates.
+func JSRenderer() macaron.Handler {
+ return macaron.Renderer(macaron.RenderOptions{
+ Funcs: NewFuncMap(),
+ Directory: path.Join(setting.StaticRootPath, "templates"),
+ AppendDirectories: []string{
+ path.Join(setting.CustomPath, "templates"),
+ },
+ HTMLContentType: "application/javascript",
+ })
+}
+
// Mailer provides the templates required for sending notification mails.
func Mailer() *template.Template {
for _, funcs := range NewFuncMap() {
diff --git a/modules/templates/static.go b/modules/templates/static.go
index 6fd4d245e1..e69e1cae48 100644
--- a/modules/templates/static.go
+++ b/modules/templates/static.go
@@ -129,6 +129,15 @@ func JSONRenderer() macaron.Handler {
})
}
+// JSRenderer implements the macaron handler for serving JS templates.
+func JSRenderer() macaron.Handler {
+ return macaron.Renderer(macaron.RenderOptions{
+ Funcs: NewFuncMap(),
+ TemplateFileSystem: NewTemplateFileSystem(),
+ HTMLContentType: "application/javascript",
+ })
+}
+
// Mailer provides the templates required for sending notification mails.
func Mailer() *template.Template {
for _, funcs := range NewFuncMap() {