diff options
author | Thibault Meyer <0xbaadf00d@users.noreply.github.com> | 2016-09-01 07:01:32 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-09-01 01:01:32 -0400 |
commit | bc902b8f745efe91e9dce5e4c5f5f2d5d760fbfb (patch) | |
tree | cdca4d2dc95875284472af47d705fb85d16176ef | |
parent | 8ee14db51ebc92728e1edba4545c7d4ea4b21c65 (diff) | |
download | gitea-bc902b8f745efe91e9dce5e4c5f5f2d5d760fbfb.tar.gz gitea-bc902b8f745efe91e9dce5e4c5f5f2d5d760fbfb.zip |
Feature #3492: Add option to hide footer load times (#3562)
* Add option to hide footer load times
* Rename option variable + minor changes
-rw-r--r-- | conf/app.ini | 4 | ||||
-rw-r--r-- | modules/setting/setting.go | 8 | ||||
-rw-r--r-- | modules/template/template.go | 3 | ||||
-rw-r--r-- | templates/base/footer.tmpl | 4 |
4 files changed, 13 insertions, 6 deletions
diff --git a/conf/app.ini b/conf/app.ini index ce5c270553..36abf40dfd 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -428,5 +428,7 @@ cs-CZ = cs-CZ [other] SHOW_FOOTER_BRANDING = false -; Show version information about gogs and go in the footer +; Show version information about Gogs and Go in the footer SHOW_FOOTER_VERSION = true +; Show time of template execution in the footer +SHOW_FOOTER_TEMPLATE_LOAD_TIME = true diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 8de205beca..cff3e7dbc2 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -246,9 +246,10 @@ var ( // Highlight settings are loaded in modules/template/hightlight.go // Other settings - ShowFooterBranding bool - ShowFooterVersion bool - SupportMiniWinService bool + ShowFooterBranding bool + ShowFooterVersion bool + ShowFooterTemplateLoadTime bool + SupportMiniWinService bool // Global setting objects Cfg *ini.File @@ -571,6 +572,7 @@ func NewContext() { ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool() ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool() + ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool() HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) } diff --git a/modules/template/template.go b/modules/template/template.go index 707697df34..3a6eb042bb 100644 --- a/modules/template/template.go +++ b/modules/template/template.go @@ -52,6 +52,9 @@ func NewFuncMap() []template.FuncMap { "DisableGravatar": func() bool { return setting.DisableGravatar }, + "ShowFooterTemplateLoadTime": func() bool { + return setting.ShowFooterTemplateLoadTime + }, "LoadTimes": func(startTime time.Time) string { return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" }, diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index 28995dcbdf..3f0190528d 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -7,7 +7,7 @@ <footer> <div class="ui container"> <div class="ui left"> - © 2016 Gogs {{if (or .ShowFooterVersion .PageIsAdmin)}}{{.i18n.Tr "version"}}: {{AppVer}}{{end}} {{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong> + © 2016 Gogs {{if (or .ShowFooterVersion .PageIsAdmin)}}{{.i18n.Tr "version"}}: {{AppVer}}{{end}} {{if ShowFooterTemplateLoadTime}}{{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong>{{end}} </div> <div class="ui right links"> {{if .ShowFooterBranding}} @@ -50,5 +50,5 @@ {{end}} <script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script> <script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script> - + </html> |