2012-11-21 06:24:05 +01:00
|
|
|
module DashboardHelper
|
|
|
|
def dashboard_filter_path(entity, options={})
|
2012-11-27 05:29:11 +01:00
|
|
|
exist_opts = {
|
|
|
|
status: params[:status],
|
|
|
|
project_id: params[:project_id],
|
|
|
|
}
|
|
|
|
|
|
|
|
options = exist_opts.merge(options)
|
|
|
|
|
2012-11-21 06:24:05 +01:00
|
|
|
case entity
|
|
|
|
when 'issue' then
|
2013-01-27 11:56:20 +01:00
|
|
|
issues_dashboard_path(options)
|
2012-11-21 06:24:05 +01:00
|
|
|
when 'merge_request'
|
2013-01-27 11:56:20 +01:00
|
|
|
merge_requests_dashboard_path(options)
|
2012-11-21 06:24:05 +01:00
|
|
|
end
|
|
|
|
end
|
2012-11-21 07:14:05 +01:00
|
|
|
|
|
|
|
def entities_per_project project, entity
|
2012-11-27 05:29:11 +01:00
|
|
|
items = project.items_for(entity)
|
|
|
|
|
|
|
|
items = case params[:status]
|
|
|
|
when 'closed'
|
|
|
|
items.closed
|
|
|
|
when 'all'
|
|
|
|
items
|
|
|
|
else
|
|
|
|
items.opened
|
|
|
|
end
|
|
|
|
|
2013-02-19 08:43:41 +01:00
|
|
|
items.cared(current_user).count
|
2012-11-21 07:14:05 +01:00
|
|
|
end
|
2012-11-21 06:24:05 +01:00
|
|
|
end
|