diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2020-01-17 08:34:37 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2020-01-17 09:34:37 +0200 |
commit | 3c07d03c0388d3b86138572401281b51f2db9282 (patch) | |
tree | 06eecf8b818ee8721a5dbfdd688eb5f45e5bef51 /templates | |
parent | 36943e56d66a2d711a6b0c27219ce91a3ddc020a (diff) | |
download | gitea-3c07d03c0388d3b86138572401281b51f2db9282.tar.gz gitea-3c07d03c0388d3b86138572401281b51f2db9282.zip |
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 <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base/head_navbar.tmpl | 6 | ||||
-rw-r--r-- | templates/org/team/new.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/settings/options.tmpl | 28 |
3 files changed, 39 insertions, 1 deletions
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}} <a class="item {{if .PageIsDashboard}}active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "dashboard"}}</a> + {{if not .UnitIssuesGlobalDisabled}} <a class="item {{if .PageIsIssues}}active{{end}}" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> + {{end}} + {{if not .UnitPullsGlobalDisabled}} <a class="item {{if .PageIsPulls}}active{{end}}" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> + {{end}} + {{if not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled)}} {{if .ShowMilestonesDashboardPage}}<a class="item {{if .PageIsMilestonesDashboard}}active{{end}}" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a>{{end}} + {{end}} <a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.i18n.Tr "explore"}}</a> {{else if .IsLandingPageHome}} <a class="item {{if .PageIsHome}}active{{end}}" href="{{AppSubUrl}}/">{{.i18n.Tr "home"}}</a> 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 @@ <label>{{.i18n.Tr "org.team_unit_desc"}}</label> <br> {{range $t, $unit := $.Units}} + {{if $unit.Type.UnitGlobalDisabled}} + <div class="field poping up" data-content="{{$.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="field"> + {{end}} <div class="ui toggle checkbox"> <input type="checkbox" class="hidden" name="units" value="{{$unit.Type.Value}}"{{if or (eq $.Team.ID 0) ($.Team.UnitEnabled $unit.Type)}} checked{{end}}> - <label>{{$.i18n.Tr $unit.NameKey}}</label> + <label>{{$.i18n.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{$.i18n.Tr "org.team_unit_disabled"}}{{end}}</label> <span class="help">{{$.i18n.Tr $unit.DescKey}}</span> </div> </div> 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)}} <div class="inline field"> <label>{{.i18n.Tr "repo.wiki"}}</label> + {{if and (.UnitTypeWiki.UnitGlobalDisabled) (.UnitTypeExternalWiki.UnitGlobalDisabled)}} + <div class="ui checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui checkbox"> + {{end}} <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}> <label>{{.i18n.Tr "repo.settings.wiki_desc"}}</label> </div> </div> <div class="field {{if not $isWikiEnabled}}disabled{{end}}" id="wiki_box"> <div class="field"> + {{if .UnitTypeWiki.UnitGlobalDisabled}} + <div class="ui radio checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui radio checkbox"> + {{end}} <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}checked{{end}}/> <label>{{.i18n.Tr "repo.settings.use_internal_wiki"}}</label> </div> </div> <div class="field"> + {{if .UnitTypeExternalWiki.UnitGlobalDisabled}} + <div class="ui radio checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui radio checkbox"> + {{end}} <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.UnitTypeExternalWiki}}checked{{end}}/> <label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label> </div> @@ -174,14 +186,22 @@ {{$isIssuesEnabled := or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypeExternalTracker)}} <div class="inline field"> <label>{{.i18n.Tr "repo.issues"}}</label> + {{if and (.UnitTypeIssues.UnitGlobalDisabled) (.UnitTypeExternalTracker.UnitGlobalDisabled)}} + <div class="ui checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui checkbox"> + {{end}} <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}> <label>{{.i18n.Tr "repo.settings.issues_desc"}}</label> </div> </div> <div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box"> <div class="field"> + {{if .UnitTypeIssues.UnitGlobalDisabled}} + <div class="ui radio checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui radio checkbox"> + {{end}} <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}checked{{end}}/> <label>{{.i18n.Tr "repo.settings.use_internal_issue_tracker"}}</label> </div> @@ -209,7 +229,11 @@ </div> </div> <div class="field"> + {{if .UnitTypeExternalTracker.UnitGlobalDisabled}} + <div class="ui radio checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui radio checkbox"> + {{end}} <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.UnitTypeExternalTracker}}checked{{end}}/> <label>{{.i18n.Tr "repo.settings.use_external_issue_tracker"}}</label> </div> @@ -251,7 +275,11 @@ {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} <div class="inline field"> <label>{{.i18n.Tr "repo.pulls"}}</label> + {{if .UnitTypePullRequests.UnitGlobalDisabled}} + <div class="ui checkbox poping up disabled" data-content="{{.i18n.Tr "repo.unit_disabled"}}"> + {{else}} <div class="ui checkbox"> + {{end}} <input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}> <label>{{.i18n.Tr "repo.settings.pulls_desc"}}</label> </div> |