2012-09-25 19:21:37 -04:00
|
|
|
class ProtectedBranchesController < ProjectController
|
2012-02-15 15:02:33 -05:00
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_read_project!
|
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
before_filter :authorize_admin_project!, only: [:destroy, :create]
|
2012-02-15 16:51:04 -05:00
|
|
|
|
2012-02-15 15:02:33 -05:00
|
|
|
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
|
2012-02-15 16:51:04 -05:00
|
|
|
@project.protected_branches.find(params[:id]).destroy
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { redirect_to project_protected_branches_path }
|
2012-08-10 18:07:50 -04:00
|
|
|
format.js { render nothing: true }
|
2012-02-15 16:51:04 -05:00
|
|
|
end
|
2012-02-15 15:02:33 -05:00
|
|
|
end
|
|
|
|
end
|