diff options
author | Chantal Rollison <crollison@gitlab.com> | 2018-08-03 19:52:37 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-08-03 19:52:37 +0000 |
commit | 90aae02bd77e438510a4c562cc75ef482cf0dcf1 (patch) | |
tree | dbde07c5b39910993c226117280cfb8f4f3b19b1 /app/models | |
parent | c4be8de7ad404f30dd6bfa9c17be4b94ecaf92e6 (diff) | |
download | gitlab-ce-90aae02bd77e438510a4c562cc75ef482cf0dcf1.tar.gz |
Add group milestones to dashboard milestone page
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/dashboard_group_milestone.rb | 36 | ||||
-rw-r--r-- | app/models/global_milestone.rb | 2 | ||||
-rw-r--r-- | app/models/group_milestone.rb | 2 |
3 files changed, 38 insertions, 2 deletions
diff --git a/app/models/dashboard_group_milestone.rb b/app/models/dashboard_group_milestone.rb new file mode 100644 index 00000000000..13807d43265 --- /dev/null +++ b/app/models/dashboard_group_milestone.rb @@ -0,0 +1,36 @@ +# 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 + + override :initialize + def initialize(milestone) + super(milestone.title, Array(milestone)) + + @group_name = milestone.group.full_name + end + + def self.build_collection(groups) + MilestonesFinder.new(group_ids: groups.pluck(:id)).execute.map { |m| new(m) } + end + + override :group_milestone? + def group_milestone? + @first_milestone.group_milestone? + end + + override :milestoneish_ids + def milestoneish_ids + milestones.map(&:id) + end + + def group + @first_milestone.group + end + + def iid + @first_milestone.iid + end +end diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb index 2ddad9b6b0b..6e23e811b0e 100644 --- a/app/models/global_milestone.rb +++ b/app/models/global_milestone.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true - +# Global Milestones are milestones that can be shared across multiple projects class GlobalMilestone include Milestoneish diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index d6ab32ea7c8..9dfaebacc83 100644 --- a/app/models/group_milestone.rb +++ b/app/models/group_milestone.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true - +# Group Milestones are milestones that can be shared among many projects within the same group class GroupMilestone < GlobalMilestone attr_accessor :group |