2012-11-21 05:24:05 +00:00
|
|
|
module DashboardHelper
|
2013-08-06 18:12:01 +00:00
|
|
|
def filter_path(entity, options={})
|
2012-11-27 04:29:11 +00:00
|
|
|
exist_opts = {
|
|
|
|
status: params[:status],
|
|
|
|
project_id: params[:project_id],
|
|
|
|
}
|
|
|
|
|
|
|
|
options = exist_opts.merge(options)
|
|
|
|
|
2013-08-06 18:12:01 +00:00
|
|
|
path = request.path
|
|
|
|
path << "?#{options.to_param}"
|
|
|
|
path
|
2012-11-21 05:24:05 +00:00
|
|
|
end
|
2012-11-21 06:14:05 +00:00
|
|
|
|
|
|
|
def entities_per_project project, entity
|
2012-11-27 04:29:11 +00:00
|
|
|
items = project.items_for(entity)
|
|
|
|
|
|
|
|
items = case params[:status]
|
|
|
|
when 'closed'
|
|
|
|
items.closed
|
|
|
|
when 'all'
|
|
|
|
items
|
|
|
|
else
|
|
|
|
items.opened
|
|
|
|
end
|
|
|
|
|
2013-02-19 07:43:41 +00:00
|
|
|
items.cared(current_user).count
|
2012-11-21 06:14:05 +00:00
|
|
|
end
|
2012-11-21 05:24:05 +00:00
|
|
|
end
|