2018-08-03 15:52:37 -04:00
|
|
|
# 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)
|
2018-12-20 06:14:33 -05:00
|
|
|
super
|
2018-08-03 15:52:37 -04:00
|
|
|
|
|
|
|
@group_name = milestone.group.full_name
|
|
|
|
end
|
|
|
|
|
2019-01-17 09:35:23 -05:00
|
|
|
def self.build_collection(groups, params)
|
|
|
|
milestones = Milestone.of_groups(groups.select(:id))
|
2018-09-17 12:35:39 -04:00
|
|
|
.reorder_by_due_date_asc
|
|
|
|
.order_by_name_asc
|
2019-01-17 09:35:23 -05:00
|
|
|
milestones = milestones.search_title(params[:search_title]) if params[:search_title].present?
|
2019-07-16 17:33:35 -04:00
|
|
|
Milestone.filter_by_state(milestones, params[:state]).map { |m| new(m) }
|
2018-08-03 15:52:37 -04:00
|
|
|
end
|
|
|
|
end
|