Commit de7d93e31fd2a35488113cac7d6f56c2c2a88306

Authored by Dmitriy Zaporozhets
2 parents d906f19c 484c0979

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
app/controllers/projects/branches_controller.rb
... ... @@ -17,9 +17,9 @@ class Projects::BranchesController < Projects::ApplicationController
17 17 end
18 18  
19 19 def create
20   - CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
  20 + @branch = CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
21 21  
22   - redirect_to project_branches_path(@project)
  22 + redirect_to project_tree_path(@project, @branch.name)
23 23 end
24 24  
25 25 def destroy
... ...
app/views/projects/branches/_branch.html.haml
1 1 - commit = @repository.commit(branch.target)
2 2 %li
3 3 %h4
4   - = link_to project_commits_path(@project, branch.name) do
  4 + = link_to project_tree_path(@project, branch.name) do
5 5 %strong= truncate(branch.name, length: 60)
6 6 - if branch.name == @repository.root_ref
7 7 %span.label.label-info default
... ...
app/views/projects/tree/show.html.haml
1 1 %div.tree-ref-holder
2 2 = render 'shared/ref_switcher', destination: 'tree', path: @path
3 3 - if can? current_user, :download_code, @project
4   - = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small tree-ref-holder pull-right', split_button: true
  4 + = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small pull-right', split_button: true
5 5 %div#tree-holder.tree-holder
6 6 = render "tree", tree: @tree
... ...
features/steps/project/browse_branches.rb
... ... @@ -44,7 +44,7 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
44 44 end
45 45  
46 46 step 'I should see new branch created' do
47   - within '.all-branches' do
  47 + within '.tree-ref-holder' do
48 48 page.should have_content 'deploy_keys'
49 49 end
50 50 end
... ...