diff options
Diffstat (limited to 'public/js/index.js')
-rw-r--r-- | public/js/index.js | 37 |
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(); |