Files
gitlabhq/app/controllers/projects/branches_controller.rb
T
Dmitriy Zaporozhets de7d93e31f Merge branch 'branch-creation-flow' into 'master'
Branch creation flow

To improve user experience with web editing I did next improvements:

* when create branch via ui - redirect to tree view so you start add/edit files
* when click on branch name - redirect to tree view instead of commits so you can immedialty add/edit files
2014-05-23 13:06:32 +00:00

34 lines
944 B
Ruby

class Projects::BranchesController < Projects::ApplicationController
# Authorize
before_filter :authorize_read_project!
before_filter :require_non_empty_project
before_filter :authorize_code_access!
before_filter :authorize_push!, only: [:create, :destroy]
def index
@sort = params[:sort] || 'name'
@branches = @repository.branches_sorted_by(@sort)
@branches = Kaminari.paginate_array(@branches).page(params[:page]).per(30)
end
def recent
@branches = @repository.recent_branches
end
def create
@branch = CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
redirect_to project_tree_path(@project, @branch.name)
end
def destroy
DeleteBranchService.new.execute(project, params[:id], current_user)
respond_to do |format|
format.html { redirect_to project_branches_path(@project) }
format.js { render nothing: true }
end
end
end