From 7e09d210ba421a1baf03ef7ba8770bebe8d28b72 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 17 Feb 2017 15:10:50 -0500 Subject: Initial version of protected branches (#776) - Able to restrict force push and deletion - Able to restrict direct push --- public/js/gogs.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'public/js') diff --git a/public/js/gogs.js b/public/js/gogs.js index 45b11fe7..58fed2cc 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -341,6 +341,18 @@ function initRepository() { }); } + // Branches + if ($('.repository.settings.branches').length > 0) { + initFilterSearchDropdown('.protected-branches .dropdown'); + $('.enable-protection').change(function () { + if (this.checked) { + $($(this).data('target')).removeClass('disabled'); + } else { + $($(this).data('target')).addClass('disabled'); + } + }); + } + // Labels if ($('.repository.labels').length > 0) { // Create label -- cgit v1.2.3