2017-09-14 16:16:22 +08:00
|
|
|
{{template "base/head" .}}
|
|
|
|
<div class="repository settings branches">
|
|
|
|
{{template "repo/header" .}}
|
|
|
|
{{template "repo/settings/navbar" .}}
|
|
|
|
<div class="ui container">
|
|
|
|
{{template "base/alert" .}}
|
|
|
|
<h4 class="ui top attached header">
|
|
|
|
{{.i18n.Tr "repo.settings.branch_protection" .Branch.BranchName | Str2html}}
|
|
|
|
</h4>
|
|
|
|
<div class="ui attached segment branch-protection">
|
|
|
|
<form class="ui form" action="{{.Link}}" method="post">
|
|
|
|
{{.CsrfTokenHtml}}
|
|
|
|
<div class="inline field">
|
|
|
|
<div class="ui checkbox">
|
|
|
|
<input class="enable-protection" name="protected" type="checkbox" data-target="#protection_box" {{if .Branch.IsProtected}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_this_branch"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_this_branch_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="protection_box" class="fields {{if not .Branch.IsProtected}}disabled{{end}}">
|
|
|
|
<div class="field">
|
2019-12-04 09:08:56 +08:00
|
|
|
<div class="ui radio checkbox">
|
|
|
|
<input name="enable_push" type="radio" value="none" class="disable-whitelist" data-target="#whitelist_box" {{if not .Branch.CanPush}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_disable_push"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_disable_push_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui radio checkbox">
|
|
|
|
<input name="enable_push" type="radio" value="all" class="disable-whitelist" data-target="#whitelist_box" {{if and (.Branch.CanPush) (not .Branch.EnableWhitelist)}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_enable_push"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_enable_push_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui radio checkbox">
|
|
|
|
<input name="enable_push" type="radio" value="whitelist" class="enable-whitelist" data-target="#whitelist_box" {{if and (.Branch.CanPush) (.Branch.EnableWhitelist)}}checked{{end}}>
|
2017-09-14 16:16:22 +08:00
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_whitelist_committers"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_whitelist_committers_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="whitelist_box" class="fields {{if not .Branch.EnableWhitelist}}disabled{{end}}">
|
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_whitelist_users"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="whitelist_users" value="{{.whitelist_users}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<img class="ui mini image" src="{{.RelAvatarLink}}">
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_whitelist_teams"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<i class="octicon octicon-jersey"></i>
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2019-10-21 16:21:45 +08:00
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
|
|
|
<div class="ui checkbox">
|
|
|
|
<input type="checkbox" name="whitelist_deploy_keys" {{if .Branch.WhitelistDeployKeys}}checked{{end}}>
|
|
|
|
<label for="whitelist_deploy_keys">{{.i18n.Tr "repo.settings.protect_whitelist_deploy_keys"}}</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-09-14 16:16:22 +08:00
|
|
|
</div>
|
2018-03-25 18:01:32 +08:00
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
|
|
|
<input class="enable-whitelist" name="enable_merge_whitelist" type="checkbox" data-target="#merge_whitelist_box" {{if .Branch.EnableMergeWhitelist}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_committers"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_merge_whitelist_committers_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="merge_whitelist_box" class="fields {{if not .Branch.EnableMergeWhitelist}}disabled{{end}}">
|
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_users"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="merge_whitelist_users" value="{{.merge_whitelist_users}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<img class="ui mini image" src="{{.RelAvatarLink}}">
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_teams"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="merge_whitelist_teams" value="{{.merge_whitelist_teams}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<i class="octicon octicon-jersey"></i>
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
2018-12-11 19:28:37 +08:00
|
|
|
|
2019-09-18 13:39:45 +08:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
|
|
|
<input class="enable-statuscheck" name="enable_status_check" type="checkbox" data-target="#statuscheck_contexts_box" {{if .Branch.EnableStatusCheck}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_check_status_contexts"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_check_status_contexts_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="statuscheck_contexts_box" class="fields {{if not .Branch.EnableStatusCheck}}disabled{{end}}">
|
|
|
|
<div class="field">
|
|
|
|
<table class="ui celled table six column">
|
|
|
|
<thead>
|
|
|
|
<tr><th>
|
|
|
|
{{.i18n.Tr "repo.settings.protect_check_status_contexts_list"}}
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{range $.branch_status_check_contexts}}
|
|
|
|
<tr><td>
|
|
|
|
<span class="ui checkbox">
|
2019-11-03 08:54:39 +08:00
|
|
|
<input class="enable-whitelist" name="status_check_contexts" value="{{.}}" type="checkbox" {{if $.is_context_required}}{{if call $.is_context_required .}}checked{{end}}{{end}}>
|
2019-09-18 13:39:45 +08:00
|
|
|
</span>
|
|
|
|
{{.}}
|
|
|
|
{{if $.is_context_required}}{{if call $.is_context_required .}}<div class="ui label right">Required</div>{{end}}{{end}}
|
|
|
|
</td></tr>
|
|
|
|
{{end}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-12-11 19:28:37 +08:00
|
|
|
<div class="field">
|
|
|
|
<label for="required-approvals">{{.i18n.Tr "repo.settings.protect_required_approvals"}}</label>
|
|
|
|
<input name="required_approvals" id="required-approvals" type="number" value="{{.Branch.RequiredApprovals}}">
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_required_approvals_desc"}}</p>
|
|
|
|
</div>
|
2019-12-04 09:08:56 +08:00
|
|
|
<div class="field">
|
|
|
|
<div class="ui checkbox">
|
|
|
|
<input class="enable-whitelist" name="enable_approvals_whitelist" type="checkbox" data-target="#approvals_whitelist_box" {{if .Branch.EnableApprovalsWhitelist}}checked{{end}}>
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_approvals_whitelist_enabled"}}</label>
|
|
|
|
<p class="help">{{.i18n.Tr "repo.settings.protect_approvals_whitelist_enabled_desc"}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="approvals_whitelist_box" class="fields {{if not .Branch.EnableApprovalsWhitelist}}disabled{{end}}">
|
2018-12-11 19:28:37 +08:00
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_approvals_whitelist_users"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="approvals_whitelist_users" value="{{.approvals_whitelist_users}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Users}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<img class="ui mini image" src="{{.RelAvatarLink}}">
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-04 09:08:56 +08:00
|
|
|
{{if .Owner.IsOrganization}}
|
|
|
|
<br>
|
|
|
|
<div class="whitelist field">
|
|
|
|
<label>{{.i18n.Tr "repo.settings.protect_approvals_whitelist_teams"}}</label>
|
|
|
|
<div class="ui multiple search selection dropdown">
|
|
|
|
<input type="hidden" name="approvals_whitelist_teams" value="{{.approvals_whitelist_teams}}">
|
|
|
|
<div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
|
|
|
|
<div class="menu">
|
|
|
|
{{range .Teams}}
|
|
|
|
<div class="item" data-value="{{.ID}}">
|
|
|
|
<i class="octicon octicon-jersey"></i>
|
|
|
|
{{.Name}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2018-12-11 19:28:37 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-04 09:08:56 +08:00
|
|
|
{{end}}
|
2018-12-11 19:28:37 +08:00
|
|
|
</div>
|
2017-09-14 16:16:22 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="ui divider"></div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-11 19:28:37 +08:00
|
|
|
{{template "base/footer" .}}
|