aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorDenis Denisov <denji@users.noreply.github.com>2017-02-21 17:02:10 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-21 23:02:10 +0800
commitfd941db246e66244ec81f43d74b8358c06173fd6 (patch)
treebe563ff04f3b809b2d11489447086d5251e9b55a /public
parentfe5ff8e4b2b3c951fa85572f3760ee2a396247ac (diff)
downloadgitea-fd941db246e66244ec81f43d74b8358c06173fd6.tar.gz
gitea-fd941db246e66244ec81f43d74b8358c06173fd6.zip
Protected branches system (#339)
* Protected branches system * Moved default branch to branches section (`:org/:reponame/settings/branches`). * Initial support Protected Branch. - Admin does not restrict - Owner not to limit - To write permission restrictions * reformat tmpl * finished the UI and add/delete protected branch response * remove unused comment * indent all the template files and remove ru translations since we use crowdin * fix the push bug
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js
index f443e52436..fb35eadf8a 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -580,6 +580,42 @@ function initRepository() {
}
}
+function initProtectedBranch() {
+ $('#protectedBranch').change(function () {
+ var $this = $(this);
+ $.post($this.data('url'), {
+ "_csrf": csrf,
+ "canPush": true,
+ "branchName": $this.val(),
+ },
+ function (data) {
+ if (data.redirect) {
+ window.location.href = data.redirect;
+ } else {
+ location.reload();
+ }
+ }
+ );
+ });
+
+ $('.rm').click(function () {
+ var $this = $(this);
+ $.post($this.data('url'), {
+ "_csrf": csrf,
+ "canPush": false,
+ "branchName": $this.data('val'),
+ },
+ function (data) {
+ if (data.redirect) {
+ window.location.href = data.redirect;
+ } else {
+ location.reload();
+ }
+ }
+ );
+ });
+}
+
function initRepositoryCollaboration() {
console.log('initRepositoryCollaboration');
@@ -1402,6 +1438,7 @@ $(document).ready(function () {
initEditForm();
initEditor();
initOrganization();
+ initProtectedBranch();
initWebhook();
initAdmin();
initCodeView();