Browse Source

fix #1957 - disable version display

This allows the admin to disable the version information about gogs and
go in use in the footer.
Gibheer 11 năm trước cách đây
mục cha
commit
56006da34b

+ 2 - 0
conf/app.ini

@@ -334,3 +334,5 @@ it-IT = it
 
 
 [other]
 [other]
 SHOW_FOOTER_BRANDING = false
 SHOW_FOOTER_BRANDING = false
+; Show version information about gogs and go in the footer
+SHOW_FOOTER_VERSION = true

+ 1 - 0
modules/middleware/context.go

@@ -245,6 +245,7 @@ func Contexter() macaron.Handler {
 
 
 		ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
 		ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
 		ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding
 		ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding
+		ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion
 
 
 		c.Map(ctx)
 		c.Map(ctx)
 	}
 	}

+ 2 - 0
modules/setting/setting.go

@@ -178,6 +178,7 @@ var (
 
 
 	// Other settings.
 	// Other settings.
 	ShowFooterBranding bool
 	ShowFooterBranding bool
+	ShowFooterVersion  bool
 
 
 	// Global setting objects.
 	// Global setting objects.
 	Cfg          *ini.File
 	Cfg          *ini.File
@@ -425,6 +426,7 @@ func NewContext() {
 	dateLangs = Cfg.Section("i18n.datelang").KeysHash()
 	dateLangs = Cfg.Section("i18n.datelang").KeysHash()
 
 
 	ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
 	ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
+	EnableShowVersion = Cfg.Section("other").Key("ENABLE_SHOW_VERSION").MustBool()
 
 
 	HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
 	HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt"))
 }
 }

+ 3 - 3
templates/base/footer.tmpl

@@ -2,7 +2,7 @@
 	<footer>
 	<footer>
 		<div class="ui container">
 		<div class="ui container">
 			<div class="ui left">
 			<div class="ui left">
-				© 2015 Gogs {{.i18n.Tr "version"}}: {{AppVer}} {{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong>
+				© 2015 Gogs {{ if .ShowFooterVersion }}{{.i18n.Tr "version"}}: {{AppVer}}{{ end }} {{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong>
 			</div>
 			</div>
 			<div class="ui right links">
 			<div class="ui right links">
 				{{if .ShowFooterBranding}}
 				{{if .ShowFooterBranding}}
@@ -20,7 +20,7 @@
 						</div>
 						</div>
         </div>
         </div>
 				<a target="_blank" href="http://gogs.io">{{.i18n.Tr "website"}}</a>
 				<a target="_blank" href="http://gogs.io">{{.i18n.Tr "website"}}</a>
-				<span class="version">{{GoVer}}</span>
+				{{ if .ShowFooterVersion }}<span class="version">{{GoVer}}</span>{{ end }}
 			</div>
 			</div>
 		</div>
 		</div>
 	</footer>
 	</footer>
@@ -46,4 +46,4 @@
 	<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.3.min.js"></script>
 	<script src="{{AppSubUrl}}/js/libs/clipboard-1.5.3.min.js"></script>
 	
 	
-</html>
+</html>

+ 3 - 3
templates/ng/base/footer.tmpl

@@ -1,7 +1,7 @@
 		</div>
 		</div>
 		<footer id="footer">
 		<footer id="footer">
 		    <div class="container clear">
 		    <div class="container clear">
-		        <p class="left" id="footer-rights">© 2015 Gogs · {{.i18n.Tr "version"}}: {{AppVer}} · {{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> ·
+		        <p class="left" id="footer-rights">© 2015 Gogs · {{ if .ShowFooterVersion }}{{.i18n.Tr "version"}}: {{AppVer}}{{ end }} · {{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> ·
 		            {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong></p>
 		            {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong></p>
 
 
 		        <div class="right" id="footer-links">
 		        <div class="right" id="footer-links">
@@ -21,9 +21,9 @@
 		                </div>
 		                </div>
 		            </div>
 		            </div>
 		            <a target="_blank" href="http://gogs.io">{{.i18n.Tr "website"}}</a>
 		            <a target="_blank" href="http://gogs.io">{{.i18n.Tr "website"}}</a>
-		            <span class="version">{{GoVer}}</span>
+		            {{ if .ShowVersionFooter }}<span class="version">{{GoVer}}</span>{{ end }}
 		        </div>
 		        </div>
 		    </div>
 		    </div>
 		</footer>
 		</footer>
 	</body>
 	</body>
-</html>
+</html>