Skip to content

Commit

Permalink
Feature gogs#3492: Add option to hide footer load times (gogs#3562)
Browse files Browse the repository at this point in the history
* Add option to hide footer load times

* Rename option variable + minor changes
  • Loading branch information
0xBAADF00D authored and unknwon committed Sep 1, 2016
1 parent 8ee14db commit bc902b8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))
}
Expand Down
3 changes: 3 additions & 0 deletions modules/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions templates/base/footer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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>

0 comments on commit bc902b8

Please sign in to comment.