Skip to content

Commit dad32a5

Browse files
committed
Dynamic templates and public integration
1 parent d33b0ee commit dad32a5

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

cmd/web.go

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"path"
1515
"strings"
1616

17-
"github.com/go-macaron/bindata"
1817
"github.com/go-macaron/binding"
1918
"github.com/go-macaron/cache"
2019
"github.com/go-macaron/captcha"
@@ -32,7 +31,6 @@ import (
3231
"github.com/go-gitea/gitea/modules/context"
3332
"github.com/go-gitea/gitea/modules/log"
3433
"github.com/go-gitea/gitea/modules/setting"
35-
"github.com/go-gitea/gitea/modules/template"
3634
"github.com/go-gitea/gitea/public"
3735
"github.com/go-gitea/gitea/routers"
3836
"github.com/go-gitea/gitea/routers/admin"
@@ -77,17 +75,10 @@ func newMacaron() *macaron.Macaron {
7775
if setting.Protocol == setting.FCGI {
7876
m.SetURLPrefix(setting.AppSubUrl)
7977
}
80-
m.Use(macaron.Static(
81-
"public",
82-
macaron.StaticOptions{
78+
m.Use(public.Static(
79+
&public.Options{
80+
Directory: path.Join(setting.StaticRootPath, "public"),
8381
SkipLogging: setting.DisableRouterLog,
84-
FileSystem: bindata.Static(bindata.Options{
85-
Asset: public.Asset,
86-
AssetDir: public.AssetDir,
87-
AssetInfo: public.AssetInfo,
88-
AssetNames: public.AssetNames,
89-
Prefix: "",
90-
}),
9182
},
9283
))
9384
m.Use(macaron.Static(
@@ -98,23 +89,23 @@ func newMacaron() *macaron.Macaron {
9889
},
9990
))
10091

101-
templateOptions := bindata.Options{
102-
Asset: templates.Asset,
103-
AssetDir: templates.AssetDir,
104-
AssetInfo: templates.AssetInfo,
105-
AssetNames: templates.AssetNames,
106-
Prefix: "",
107-
}
92+
m.Use(templates.Renderer(
93+
&templates.Options{
94+
Directory: path.Join(setting.StaticRootPath, "templates"),
95+
AppendDirectories: []string{path.Join(setting.CustomPath, "templates")},
96+
},
97+
))
10898

109-
funcMap := template.NewFuncMap()
110-
m.Use(macaron.Renderer(macaron.RenderOptions{
111-
AppendDirectories: []string{path.Join(setting.CustomPath, "templates")},
112-
Funcs: funcMap,
113-
IndentJSON: macaron.Env != macaron.PROD,
114-
TemplateFileSystem: bindata.Templates(templateOptions),
115-
}))
116-
models.InitMailRender(templateOptions,
117-
path.Join(setting.CustomPath, "templates/mail"), funcMap)
99+
// templateOptions := bindata.Options{
100+
// Asset: templates.Asset,
101+
// AssetDir: templates.AssetDir,
102+
// AssetInfo: templates.AssetInfo,
103+
// AssetNames: templates.AssetNames,
104+
// Prefix: "",
105+
// }
106+
107+
// models.InitMailRender(templateOptions,
108+
// path.Join(setting.CustomPath, "templates/mail"), funcMap)
118109

119110
localeNames, err := conf.AssetDir("locale")
120111
if err != nil {

0 commit comments

Comments
 (0)