summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-25 09:19:51 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-25 09:19:51 +0200
commit1a2e11c891ef4a2a87b84f2b0b36316bb809ff14 (patch)
tree1c8fa16e1127f87f12e6c94584ce7cf83746c2db
parentf6a4e5636d2ed6d99006c36b59da04ec86dfebab (diff)
downloadgitlab-ce-1a2e11c891ef4a2a87b84f2b0b36316bb809ff14.tar.gz
Fix per-project counters for Dashboard filters
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/helpers/dashboard_helper.rb18
-rw-r--r--app/views/shared/_filter.html.haml2
-rw-r--r--features/steps/dashboard/dashboard_issues.rb2
-rw-r--r--features/steps/dashboard/dashboard_merge_requests.rb2
4 files changed, 9 insertions, 15 deletions
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index cbc8c336bea..d93eac407b7 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -14,17 +14,11 @@ module DashboardHelper
end
def entities_per_project(project, entity)
- items = project.items_for(entity)
-
- items = case params[:status]
- when 'closed'
- items.closed
- when 'all'
- items
- else
- items.opened
- end
-
- items.cared(current_user).count
+ case entity.to_sym
+ when :issue then @issues.where(project_id: project.id)
+ when :merge_request then @merge_requests.where(target_project_id: project.id)
+ else
+ []
+ end.count
end
end
diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml
index d48a8d6c1dd..13bda305d77 100644
--- a/app/views/shared/_filter.html.haml
+++ b/app/views/shared/_filter.html.haml
@@ -6,7 +6,7 @@
Assigned to me
%li{class: ("active" if params[:scope] == 'authored')}
= link_to filter_path(entity, scope: 'authored') do
- Authored by me
+ Created by me
%li{class: ("active" if params[:scope] == 'all')}
= link_to filter_path(entity, scope: 'all') do
All
diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb
index 47d83f73ed2..9d486bd8156 100644
--- a/features/steps/dashboard/dashboard_issues.rb
+++ b/features/steps/dashboard/dashboard_issues.rb
@@ -34,7 +34,7 @@ class DashboardIssues < Spinach::FeatureSteps
step 'I click "Authored by me" link' do
within ".scope-filter" do
- click_link 'Authored by me'
+ click_link 'Created by me'
end
end
diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb
index 3c35462a8db..f6fe47470b3 100644
--- a/features/steps/dashboard/dashboard_merge_requests.rb
+++ b/features/steps/dashboard/dashboard_merge_requests.rb
@@ -34,7 +34,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps
step 'I click "Authored by me" link' do
within ".scope-filter" do
- click_link 'Authored by me'
+ click_link 'Created by me'
end
end