Welcome to mirror list, hosted at ThFree Co, Russian Federation.

protected_branches_controller.rb « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fd2734eff849bba5d224452286dd0a564e179ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class ProtectedBranchesController < ProjectResourceController
  # 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