diff options
Diffstat (limited to 'modules/templates/dynamic.go')
-rw-r--r-- | modules/templates/dynamic.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/templates/dynamic.go b/modules/templates/dynamic.go index c127b69470..d70a465c1c 100644 --- a/modules/templates/dynamic.go +++ b/modules/templates/dynamic.go @@ -22,8 +22,8 @@ var ( templates = template.New("") ) -// Renderer implements the macaron handler for serving the templates. -func Renderer() macaron.Handler { +// HTMLRenderer implements the macaron handler for serving HTML templates. +func HTMLRenderer() macaron.Handler { return macaron.Renderer(macaron.RenderOptions{ Funcs: NewFuncMap(), Directory: path.Join(setting.StaticRootPath, "templates"), @@ -33,6 +33,18 @@ func Renderer() macaron.Handler { }) } +// JSONRenderer implements the macaron handler for serving JSON templates. +func JSONRenderer() macaron.Handler { + return macaron.Renderer(macaron.RenderOptions{ + Funcs: NewFuncMap(), + Directory: path.Join(setting.StaticRootPath, "templates"), + AppendDirectories: []string{ + path.Join(setting.CustomPath, "templates"), + }, + HTMLContentType: "application/json", + }) +} + // Mailer provides the templates required for sending notification mails. func Mailer() *template.Template { for _, funcs := range NewFuncMap() { |