2012-11-21 00:24:05 -05:00
|
|
|
module DashboardHelper
|
2013-08-06 14:12:01 -04:00
|
|
|
def filter_path(entity, options={})
|
2012-11-26 23:29:11 -05:00
|
|
|
exist_opts = {
|
|
|
|
status: params[:status],
|
2013-12-25 02:08:56 -05:00
|
|
|
scope: params[:scope],
|
2012-11-26 23:29:11 -05:00
|
|
|
project_id: params[:project_id],
|
|
|
|
}
|
|
|
|
|
|
|
|
options = exist_opts.merge(options)
|
|
|
|
|
2013-08-06 14:12:01 -04:00
|
|
|
path = request.path
|
|
|
|
path << "?#{options.to_param}"
|
|
|
|
path
|
2012-11-21 00:24:05 -05:00
|
|
|
end
|
2012-11-21 01:14:05 -05:00
|
|
|
|
2013-12-25 02:08:56 -05:00
|
|
|
def entities_per_project(project, entity)
|
2013-12-25 02:19:51 -05:00
|
|
|
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
|
2012-11-21 01:14:05 -05:00
|
|
|
end
|
2012-11-21 00:24:05 -05:00
|
|
|
end
|