diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-02-12 01:08:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 01:08:22 +0800 |
commit | e0688995efdeaf5da2997779e369cc27a5ce6a5e (patch) | |
tree | 2e4f2f819822db659f946fe9ce726b8cb8030127 /modules | |
parent | c86ecaebae5d4db60edaf3ffdc0ee8ce40707e67 (diff) | |
download | gitea-e0688995efdeaf5da2997779e369cc27a5ce6a5e.tar.gz gitea-e0688995efdeaf5da2997779e369cc27a5ce6a5e.zip |
Display template path of current page in dev mode (#18717)
* Display template path of current page in dev mode
* improve code
* Update templates/base/footer_content.tmpl
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/context.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index 7ae37208e4..6aeeb9e694 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -197,7 +197,10 @@ func (ctx *Context) RedirectToFirst(location ...string) { func (ctx *Context) HTML(status int, name base.TplName) { log.Debug("Template: %s", name) tmplStartTime := time.Now() - ctx.Data["TmplLoadTimes"] = func() string { + if !setting.IsProd { + ctx.Data["TemplateName"] = name + } + ctx.Data["TemplateLoadTimes"] = func() string { return strconv.FormatInt(time.Since(tmplStartTime).Nanoseconds()/1e6, 10) + "ms" } if err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data); err != nil { |