gitlab-org--gitlab-foss/app/helpers/dashboard_helper.rb

33 lines
702 B
Ruby
Raw Normal View History

2012-11-21 00:24:05 -05:00
module DashboardHelper
def dashboard_filter_path(entity, options={})
2012-11-26 23:29:11 -05:00
exist_opts = {
status: params[:status],
project_id: params[:project_id],
}
options = exist_opts.merge(options)
2012-11-21 00:24:05 -05:00
case entity
when 'issue' then
dashboard_issues_path(options)
when 'merge_request'
dashboard_merge_requests_path(options)
end
end
2012-11-21 01:14:05 -05:00
def entities_per_project project, entity
2012-11-26 23:29:11 -05:00
items = project.items_for(entity)
items = case params[:status]
when 'closed'
items.closed
when 'all'
items
else
items.opened
end
items.where(assignee_id: current_user.id).count
2012-11-21 01:14:05 -05:00
end
2012-11-21 00:24:05 -05:00
end