Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2014-05-17 13:36:39 +0400
committerJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2014-05-23 22:23:59 +0400
commitd0e794cc1a7eba4d438841d6a661bc41687e624e (patch)
tree65062f799704f3b86249983040cbe60e8e359532 /app/views
parent3e1853c5a0d89147a6a44a31a302f93e96c2ed92 (diff)
Make sure the branch counter gets updated
When you delete a branch, the counters wont get updated automaticly, this happends because of the JS nature of the original call. I've fixed this by responding with a JS file, and recalculate the counters. Fixes: #6030
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/branches/_branch.html.haml2
-rw-r--r--app/views/projects/branches/destroy.js.haml5
-rw-r--r--app/views/projects/commits/_head.html.haml2
3 files changed, 7 insertions, 2 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 2abcd00ee81..54a7b934dd7 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 00000000000..2cba6d37452
--- /dev/null
+++ b/app/views/projects/branches/destroy.js.haml
@@ -0,0 +1,5 @@
+:plain
+ $(".js-branch-#{@branch.name}").remove();
+ $('.js-recentbranch-count').html("#{@repository.recent_branches.count}")
+ $('.js-protectedbranch-count').html("#{@project.protected_branches.count}")
+ $('.js-totalbranch-count').html("#{@repository.branch_names.count}")
diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml
index 0facfc4b5f1..1bb4d9bfab4 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