BigW Consortium Gitlab

dashboard_helper.rb 702 Bytes
Newer Older
1 2
module DashboardHelper
  def dashboard_filter_path(entity, options={})
3 4 5 6 7 8 9
    exist_opts = {
      status: params[:status],
      project_id: params[:project_id],
    }

    options = exist_opts.merge(options)

10 11 12 13 14 15 16
    case entity
    when 'issue' then
      dashboard_issues_path(options)
    when 'merge_request'
      dashboard_merge_requests_path(options)
    end
  end
Dmitriy Zaporozhets committed
17 18

  def entities_per_project project, entity
19 20 21 22 23 24 25 26 27 28 29 30
    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
Dmitriy Zaporozhets committed
31
  end
32
end