gitlab-org--gitlab-foss/app/controllers/projects/branches_controller.rb

32 lines
845 B
Ruby
Raw Normal View History

class Projects::BranchesController < Projects::ApplicationController
# Authorize
before_filter :authorize_read_project!
before_filter :require_non_empty_project
2013-07-17 01:26:00 -04:00
before_filter :authorize_code_access!
before_filter :authorize_push!, only: [:create, :destroy]
def index
@branches = Kaminari.paginate_array(@repository.branches).page(params[:page]).per(30)
end
2013-08-05 10:59:58 -04:00
def recent
@branches = @repository.recent_branches
end
def create
CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
2013-07-16 17:09:23 -04:00
redirect_to project_branches_path(@project)
end
def destroy
DeleteBranchService.new.execute(project, params[:id], current_user)
respond_to do |format|
2013-07-16 17:09:23 -04:00
format.html { redirect_to project_branches_path(@project) }
format.js { render nothing: true }
end
end
end