dashboard_group_milestone.rb 700 Bytes
Newer Older
1 2 3 4 5 6 7 8
# frozen_string_literal: true
# Dashboard Group Milestones are milestones that allow us to pull more info out for the UI that the Milestone object doesn't allow for
class DashboardGroupMilestone < GlobalMilestone
  extend ::Gitlab::Utils::Override

  attr_reader :group_name

  def initialize(milestone)
9
    super
10 11 12 13

    @group_name = milestone.group.full_name
  end

Jacopo's avatar
Jacopo committed
14 15
  def self.build_collection(groups, params)
    milestones = Milestone.of_groups(groups.select(:id))
16 17 18
             .reorder_by_due_date_asc
             .order_by_name_asc
             .active
Jacopo's avatar
Jacopo committed
19 20
    milestones = milestones.search_title(params[:search_title]) if params[:search_title].present?
    milestones.map { |m| new(m) }
21 22
  end
end