summaryrefslogtreecommitdiffstats
path: root/templates/repo/settings
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2018-12-11 12:28:37 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2018-12-11 19:28:37 +0800
commit9681c8373426e8364760f033b9935b81b9276351 (patch)
treed9308c33809fdfa7859fd9a1057432a74a28c92f /templates/repo/settings
parent64680b72bd1b0a0fc164296ff0cc7319ae7dc4ca (diff)
downloadgitea-9681c8373426e8364760f033b9935b81b9276351.tar.gz
gitea-9681c8373426e8364760f033b9935b81b9276351.zip
Approvals at Branch Protection (#5350)
* Add branch protection for approvals Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add required approvals Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing comments and fmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add type = approval and group by reviewer_id to review * Prevent users from adding negative review limits * Add migration for approval whitelists Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'templates/repo/settings')
-rw-r--r--templates/repo/settings/protected_branch.tmpl43
1 files changed, 42 insertions, 1 deletions
diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl
index 6c892b662a..066350f97a 100644
--- a/templates/repo/settings/protected_branch.tmpl
+++ b/templates/repo/settings/protected_branch.tmpl
@@ -103,6 +103,47 @@
</div>
{{end}}
</div>
+
+ <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>
+ <div class="fields">
+ <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>
+ {{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}}
+ </div>
+ </div>
+ </div>
+ {{end}}
+ </div>
</div>
<div class="ui divider"></div>
@@ -114,4 +155,4 @@
</div>
</div>
</div>
-{{template "base/footer" .}} \ No newline at end of file
+{{template "base/footer" .}}