Browse Source

Feature #3492: Add option to hide footer load times (#3562)

* Add option to hide footer load times

* Rename option variable + minor changes
tags/v0.9.99
Thibault Meyer 7 years ago
parent
commit
bc902b8f74
4 changed files with 13 additions and 6 deletions
  1. 3
    1
      conf/app.ini
  2. 5
    3
      modules/setting/setting.go
  3. 3
    0
      modules/template/template.go
  4. 2
    2
      templates/base/footer.tmpl

+ 3
- 1
conf/app.ini View File



[other] [other]
SHOW_FOOTER_BRANDING = false 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_FOOTER_VERSION = true
; Show time of template execution in the footer
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true

+ 5
- 3
modules/setting/setting.go View File

// Highlight settings are loaded in modules/template/hightlight.go // Highlight settings are loaded in modules/template/hightlight.go


// Other settings // Other settings
ShowFooterBranding bool
ShowFooterVersion bool
SupportMiniWinService bool
ShowFooterBranding bool
ShowFooterVersion bool
ShowFooterTemplateLoadTime bool
SupportMiniWinService bool


// Global setting objects // Global setting objects
Cfg *ini.File Cfg *ini.File


ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool() ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").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")) HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
} }

+ 3
- 0
modules/template/template.go View File

"DisableGravatar": func() bool { "DisableGravatar": func() bool {
return setting.DisableGravatar return setting.DisableGravatar
}, },
"ShowFooterTemplateLoadTime": func() bool {
return setting.ShowFooterTemplateLoadTime
},
"LoadTimes": func(startTime time.Time) string { "LoadTimes": func(startTime time.Time) string {
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
}, },

+ 2
- 2
templates/base/footer.tmpl View File

<footer> <footer>
<div class="ui container"> <div class="ui container">
<div class="ui left"> <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>
<div class="ui right links"> <div class="ui right links">
{{if .ShowFooterBranding}} {{if .ShowFooterBranding}}
{{end}} {{end}}
<script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script> <script src="{{AppSubUrl}}/js/libs/emojify-1.1.0.min.js"></script>
<script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script> <script src="{{AppSubUrl}}/js/libs/clipboard-1.5.9.min.js"></script>
</html> </html>

Loading…
Cancel
Save