Fix per-project counters for Dashboard filters
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
f6a4e5636d
commit
1a2e11c891
|
@ -14,17 +14,11 @@ module DashboardHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def entities_per_project(project, entity)
|
def entities_per_project(project, entity)
|
||||||
items = project.items_for(entity)
|
case entity.to_sym
|
||||||
|
when :issue then @issues.where(project_id: project.id)
|
||||||
items = case params[:status]
|
when :merge_request then @merge_requests.where(target_project_id: project.id)
|
||||||
when 'closed'
|
else
|
||||||
items.closed
|
[]
|
||||||
when 'all'
|
end.count
|
||||||
items
|
|
||||||
else
|
|
||||||
items.opened
|
|
||||||
end
|
|
||||||
|
|
||||||
items.cared(current_user).count
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
Assigned to me
|
Assigned to me
|
||||||
%li{class: ("active" if params[:scope] == 'authored')}
|
%li{class: ("active" if params[:scope] == 'authored')}
|
||||||
= link_to filter_path(entity, scope: 'authored') do
|
= link_to filter_path(entity, scope: 'authored') do
|
||||||
Authored by me
|
Created by me
|
||||||
%li{class: ("active" if params[:scope] == 'all')}
|
%li{class: ("active" if params[:scope] == 'all')}
|
||||||
= link_to filter_path(entity, scope: 'all') do
|
= link_to filter_path(entity, scope: 'all') do
|
||||||
All
|
All
|
||||||
|
|
|
@ -34,7 +34,7 @@ class DashboardIssues < Spinach::FeatureSteps
|
||||||
|
|
||||||
step 'I click "Authored by me" link' do
|
step 'I click "Authored by me" link' do
|
||||||
within ".scope-filter" do
|
within ".scope-filter" do
|
||||||
click_link 'Authored by me'
|
click_link 'Created by me'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps
|
||||||
|
|
||||||
step 'I click "Authored by me" link' do
|
step 'I click "Authored by me" link' do
|
||||||
within ".scope-filter" do
|
within ".scope-filter" do
|
||||||
click_link 'Authored by me'
|
click_link 'Created by me'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue