Commit e569cf369ab9457d078c0f40dbbb7a67db4c6221

Authored by Dmitriy Zaporozhets
2 parents 6fdd9008 4ac56fa1

Merge pull request #6991 from jvanbaarsen/branch-counter-after-delete

Make sure the branch counter gets updated
app/controllers/projects/branches_controller.rb
... ... @@ -24,10 +24,11 @@ class Projects::BranchesController < Projects::ApplicationController
24 24  
25 25 def destroy
26 26 DeleteBranchService.new.execute(project, params[:id], current_user)
  27 + @branch_name = params[:id]
27 28  
28 29 respond_to do |format|
29 30 format.html { redirect_to project_branches_path(@project) }
30   - format.js { render nothing: true }
  31 + format.js
31 32 end
32 33 end
33 34 end
... ...
app/views/projects/branches/_branch.html.haml
1 1 - commit = @repository.commit(branch.target)
2   -%li
  2 +%li(class="js-branch-#{branch.name}")
3 3 %h4
4 4 = link_to project_tree_path(@project, branch.name) do
5 5 %strong= truncate(branch.name, length: 60)
... ...
app/views/projects/branches/destroy.js.haml 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +:plain
  2 + $(".js-branch-#{@branch_name}").remove();
  3 + $('.js-totalbranch-count').html("#{@repository.branches.size}")
... ...
app/views/projects/commits/_head.html.haml
... ... @@ -9,7 +9,7 @@
9 9 = nav_link(html_options: {class: branches_tab_class}) do
10 10 = link_to project_branches_path(@project) do
11 11 Branches
12   - %span.badge= @repository.branches.size
  12 + %span.badge.js-totalbranch-count= @repository.branches.size
13 13  
14 14 = nav_link(controller: :tags) do
15 15 = link_to project_tags_path(@project) do
... ...