Skip to content

Commit bc902b8

Browse files
0xBAADF00Dunknwon
authored andcommitted
Feature #3492: Add option to hide footer load times (#3562)
* Add option to hide footer load times * Rename option variable + minor changes
1 parent 8ee14db commit bc902b8

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

conf/app.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,5 +428,7 @@ cs-CZ = cs-CZ
428428

429429
[other]
430430
SHOW_FOOTER_BRANDING = false
431-
; Show version information about gogs and go in the footer
431+
; Show version information about Gogs and Go in the footer
432432
SHOW_FOOTER_VERSION = true
433+
; Show time of template execution in the footer
434+
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true

modules/setting/setting.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,10 @@ var (
246246
// Highlight settings are loaded in modules/template/hightlight.go
247247

248248
// Other settings
249-
ShowFooterBranding bool
250-
ShowFooterVersion bool
251-
SupportMiniWinService bool
249+
ShowFooterBranding bool
250+
ShowFooterVersion bool
251+
ShowFooterTemplateLoadTime bool
252+
SupportMiniWinService bool
252253

253254
// Global setting objects
254255
Cfg *ini.File
@@ -571,6 +572,7 @@ func NewContext() {
571572

572573
ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
573574
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool()
575+
ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool()
574576

575577
HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
576578
}

modules/template/template.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ func NewFuncMap() []template.FuncMap {
5252
"DisableGravatar": func() bool {
5353
return setting.DisableGravatar
5454
},
55+
"ShowFooterTemplateLoadTime": func() bool {
56+
return setting.ShowFooterTemplateLoadTime
57+
},
5558
"LoadTimes": func(startTime time.Time) string {
5659
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
5760
},

templates/base/footer.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<footer>
88
<div class="ui container">
99
<div class="ui left">
10-
© 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>
10+
© 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}}
1111
</div>
1212
<div class="ui right links">
1313
{{if .ShowFooterBranding}}
@@ -50,5 +50,5 @@
5050
{{end}}
5151
<script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script>
5252
<script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script>
53-
53+
5454
</html>

0 commit comments

Comments
 (0)