From 56d931aeac653ed948cbecf643fc74809b32dec3 Mon Sep 17 00:00:00 2001 From: Piotr Orzechowski Date: Mon, 27 Aug 2018 04:23:27 +0200 Subject: [PATCH] Hide home button when landing page is not set to home (#4651) --- modules/context/context.go | 5 +++++ templates/base/head.tmpl | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/context/context.go b/modules/context/context.go index a83187365..b9736e56e 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -261,9 +261,14 @@ func Contexter() macaron.Handler { log.Debug("Session ID: %s", sess.ID()) log.Debug("CSRF Token: %v", ctx.Data["CsrfToken"]) + ctx.Data["IsLandingPageHome"] = setting.LandingPageURL == setting.LandingPageHome + ctx.Data["IsLandingPageExplore"] = setting.LandingPageURL == setting.LandingPageExplore + ctx.Data["IsLandingPageOrganizations"] = setting.LandingPageURL == setting.LandingPageOrganizations + ctx.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton ctx.Data["ShowFooterBranding"] = setting.ShowFooterBranding ctx.Data["ShowFooterVersion"] = setting.ShowFooterVersion + ctx.Data["EnableSwagger"] = setting.API.EnableSwagger ctx.Data["EnableOpenIDSignIn"] = setting.Service.EnableOpenIDSignIn diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index a59341496..65eec65e5 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -153,15 +153,19 @@ {{if .IsSigned}} - {{.i18n.Tr "dashboard"}} - {{.i18n.Tr "issues"}} - {{.i18n.Tr "pull_requests"}} - {{else}} - {{.i18n.Tr "home"}} + {{.i18n.Tr "dashboard"}} + {{.i18n.Tr "issues"}} + {{.i18n.Tr "pull_requests"}} + {{.i18n.Tr "explore"}} + {{else if .IsLandingPageHome}} + {{.i18n.Tr "home"}} + {{.i18n.Tr "explore"}} + {{else if .IsLandingPageExplore}} + {{.i18n.Tr "home"}} + {{else if .IsLandingPageOrganizations}} + {{.i18n.Tr "home"}} {{end}} - {{.i18n.Tr "explore"}} - {{template "custom/extra_links" .}} {{/*