]> source.dussan.org Git - gitea.git/commitdiff
Feature #3492: Add option to hide footer load times (#3562)
authorThibault Meyer <0xbaadf00d@users.noreply.github.com>
Thu, 1 Sep 2016 05:01:32 +0000 (07:01 +0200)
committer无闻 <u@gogs.io>
Thu, 1 Sep 2016 05:01:32 +0000 (01:01 -0400)
* Add option to hide footer load times

* Rename option variable + minor changes

conf/app.ini
modules/setting/setting.go
modules/template/template.go
templates/base/footer.tmpl

index ce5c270553d7c4a07a4341bd1aa3ae9d39eedbd8..36abf40dfd11ef0dc6e555a83683ec7324301be3 100644 (file)
@@ -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
index 8de205beca8380e8435caee398b937fd8ffa0058..cff3e7dbc255e000c90130e974d1049005eddbee 100644 (file)
@@ -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"))
 }
index 707697df341f95f13553cb237a2aef1460d5d40e..3a6eb042bb923efd91e0140efef3c26ad5dfa4f9 100644 (file)
@@ -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"
                },
index 28995dcbdf2a83a1c1aa3ce0424ec656a1c3f7af..3f0190528d3f5043cadda8a579ad695baa51547e 100644 (file)
@@ -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>