Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-13 21:20:48 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 16:07:38 +0300
commit986695e136a8f6afa326048b30be77a9265d3bf7 (patch)
tree390e60bd0213b3c431094cfe71395be845b77714 /app/models/global_label.rb
parent05335a3c8584c48a9317bd0919eccee6948de742 (diff)
Refactor global and group milestones logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/global_label.rb')
-rw-r--r--app/models/global_label.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/global_label.rb b/app/models/global_label.rb
new file mode 100644
index 00000000000..0171f7d54b7
--- /dev/null
+++ b/app/models/global_label.rb
@@ -0,0 +1,17 @@
+class GlobalLabel
+ attr_accessor :title, :labels
+ alias_attribute :name, :title
+
+ def self.build_collection(labels)
+ labels = labels.group_by(&:title)
+
+ labels.map do |title, label|
+ new(title, label)
+ end
+ end
+
+ def initialize(title, labels)
+ @title = title
+ @labels = labels
+ end
+end