Skip to content

Commit 56d931a

Browse files
0rzechtechknowlogick
authored andcommitted
Hide home button when landing page is not set to home (#4651)
1 parent 4ae5a54 commit 56d931a

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

modules/context/context.go

+5
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,14 @@ func Contexter() macaron.Handler {
261261
log.Debug("Session ID: %s", sess.ID())
262262
log.Debug("CSRF Token: %v", ctx.Data["CsrfToken"])
263263

264+
ctx.Data["IsLandingPageHome"] = setting.LandingPageURL == setting.LandingPageHome
265+
ctx.Data["IsLandingPageExplore"] = setting.LandingPageURL == setting.LandingPageExplore
266+
ctx.Data["IsLandingPageOrganizations"] = setting.LandingPageURL == setting.LandingPageOrganizations
267+
264268
ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
265269
ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding
266270
ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion
271+
267272
ctx.Data["EnableSwagger"] = setting.API.EnableSwagger
268273
ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn
269274

templates/base/head.tmpl

+11-7
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,19 @@
153153
</div>
154154

155155
{{if .IsSigned}}
156-
<a class="item{{if .PageIsDashboard}} active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "dashboard"}}</a>
157-
<a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a>
158-
<a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a>
159-
{{else}}
160-
<a class="item{{if .PageIsHome}} active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "home"}}</a>
156+
<a class="item {{if .PageIsDashboard}}active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "dashboard"}}</a>
157+
<a class="item {{if .PageIsIssues}}active{{end}}" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a>
158+
<a class="item {{if .PageIsPulls}}active{{end}}" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a>
159+
<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "explore"}}</a>
160+
{{else if .IsLandingPageHome}}
161+
<a class="item {{if .PageIsHome}}active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "home"}}</a>
162+
<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "explore"}}</a>
163+
{{else if .IsLandingPageExplore}}
164+
<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "home"}}</a>
165+
{{else if .IsLandingPageOrganizations}}
166+
<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{.i18n.Tr "home"}}</a>
161167
{{end}}
162168

163-
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "explore"}}</a>
164-
165169
{{template "custom/extra_links" .}}
166170

167171
{{/*

0 commit comments

Comments
 (0)