diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index ab8892bbf0beef08a5e417a3874d9d4e4fe90cca..3c8e7ec73f6dedf53d9719d6bda430476cd8e902 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -24,10 +24,11 @@ class Projects::BranchesController < Projects::ApplicationController def destroy DeleteBranchService.new.execute(project, params[:id], current_user) + @branch_name = params[:id] respond_to do |format| format.html { redirect_to project_branches_path(@project) } - format.js { render nothing: true } + format.js end end end diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 2abcd00ee81261f635785c76f20d2413019e6fb3..54a7b934dd7c9d13d1bf1484411d5043a69a2160 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -1,5 +1,5 @@ - commit = @repository.commit(branch.target) -%li +%li(class="js-branch-#{branch.name}") %h4 = link_to project_tree_path(@project, branch.name) do %strong= truncate(branch.name, length: 60) diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml new file mode 100644 index 0000000000000000000000000000000000000000..ec1661c0aaae9558fa3d193a84dc675fe0233c7f --- /dev/null +++ b/app/views/projects/branches/destroy.js.haml @@ -0,0 +1,3 @@ +:plain + $(".js-branch-#{@branch_name}").remove(); + $('.js-totalbranch-count').html("#{@repository.branches.size}") diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index 0facfc4b5f1d52f88a7dce9ddc23fd8bc3e541d3..1bb4d9bfab4c703345a7909e7f822fbd1df0fca1 100644 --- a/app/views/projects/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml @@ -9,7 +9,7 @@ = nav_link(html_options: {class: branches_tab_class}) do = link_to project_branches_path(@project) do Branches - %span.badge= @repository.branches.size + %span.badge.js-totalbranch-count= @repository.branches.size = nav_link(controller: :tags) do = link_to project_tags_path(@project) do