summaryrefslogtreecommitdiff
path: root/app/controllers/projects/protected_branches_controller.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-23 19:47:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-23 19:47:22 +0300
commit2ed7cbfba4ff3c6a4cf3e72515a0375544998de0 (patch)
treeae6d7530745c80633cd993c99f7820e1452f3e1b /app/controllers/projects/protected_branches_controller.rb
parent95791316f4037273af7b747ce1851d5f4e46933f (diff)
downloadgitlab-ce-2ed7cbfba4ff3c6a4cf3e72515a0375544998de0.tar.gz
Move projects controllers/views in Projects module
Diffstat (limited to 'app/controllers/projects/protected_branches_controller.rb')
-rw-r--r--app/controllers/projects/protected_branches_controller.rb26
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