forked from forgejo/forgejo
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
This commit is contained in:
parent
fe5ff8e4b2
commit
fd941db246
17 changed files with 606 additions and 49 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue