From 3c07d03c0388d3b86138572401281b51f2db9282 Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Fri, 17 Jan 2020 08:34:37 +0100 Subject: Add setting to set default and global disabled repository units. (#8788) * Add possibility to global disable repo units. * Add Default Repo Unit app.ini setting. * Hide units * Hide disabled repo units * Minor fixes * Indicate disabled units in team settings. Co-authored-by: Lauris BH Co-authored-by: Lunny Xiao Co-authored-by: zeripath --- templates/base/head_navbar.tmpl | 6 ++++++ templates/org/team/new.tmpl | 6 +++++- templates/repo/settings/options.tmpl | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index a09b4b832e..5f1b9405d9 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -10,9 +10,15 @@ {{if .IsSigned}} {{.i18n.Tr "dashboard"}} + {{if not .UnitIssuesGlobalDisabled}} {{.i18n.Tr "issues"}} + {{end}} + {{if not .UnitPullsGlobalDisabled}} {{.i18n.Tr "pull_requests"}} + {{end}} + {{if not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled)}} {{if .ShowMilestonesDashboardPage}}{{.i18n.Tr "milestones"}}{{end}} + {{end}} {{.i18n.Tr "explore"}} {{else if .IsLandingPageHome}} {{.i18n.Tr "home"}} diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index c38fa4d940..228f86824a 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -81,10 +81,14 @@
{{range $t, $unit := $.Units}} + {{if $unit.Type.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
- + {{$.i18n.Tr $unit.DescKey}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 6f96ff7f47..c674fcf7f9 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -144,20 +144,32 @@ {{$isWikiEnabled := or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}
+ {{if and (.UnitTypeWiki.UnitGlobalDisabled) (.UnitTypeExternalWiki.UnitGlobalDisabled)}} +
+ {{else}}
+ {{end}}
+ {{if .UnitTypeWiki.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
+ {{if .UnitTypeExternalWiki.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
@@ -174,14 +186,22 @@ {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}
+ {{if and (.UnitTypeIssues.UnitGlobalDisabled) (.UnitTypeExternalTracker.UnitGlobalDisabled)}} +
+ {{else}}
+ {{end}}
+ {{if .UnitTypeIssues.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
@@ -209,7 +229,11 @@
+ {{if .UnitTypeExternalTracker.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
@@ -251,7 +275,11 @@ {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
+ {{if .UnitTypePullRequests.UnitGlobalDisabled}} +
+ {{else}}
+ {{end}}
-- cgit v1.2.3