diff options
Diffstat (limited to 'app/controllers/projects/protected_branches_controller.rb')
-rw-r--r-- | app/controllers/projects/protected_branches_controller.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb new file mode 100644 index 00000000000..81531bb0ac0 --- /dev/null +++ b/app/controllers/projects/protected_branches_controller.rb @@ -0,0 +1,26 @@ +class Projects::ProtectedBranchesController < Projects::ApplicationController + # Authorize + before_filter :authorize_read_project! + before_filter :require_non_empty_project + + before_filter :authorize_admin_project!, only: [:destroy, :create] + + def index + @branches = @project.protected_branches.all + @protected_branch = @project.protected_branches.new + end + + def create + @project.protected_branches.create(params[:protected_branch]) + redirect_to project_protected_branches_path(@project) + end + + def destroy + @project.protected_branches.find(params[:id]).destroy + + respond_to do |format| + format.html { redirect_to project_protected_branches_path } + format.js { render nothing: true } + end + end +end |