diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-29 23:19:47 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-29 23:19:47 +0400 |
commit | b2a6f4e13632c6f00620cdd7116d7b29d257c738 (patch) | |
tree | 08c99cbbe20182cb1bf019550ff56b2899f0f122 /lib/gitlab/issues_labels.rb | |
parent | d79c0ea271f20b148ab433c0d510f90f1b807b74 (diff) |
Refactor label rendering and default label set generation
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/gitlab/issues_labels.rb')
-rw-r--r-- | lib/gitlab/issues_labels.rb | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/gitlab/issues_labels.rb b/lib/gitlab/issues_labels.rb index 9da1977a3d6..0d34976736f 100644 --- a/lib/gitlab/issues_labels.rb +++ b/lib/gitlab/issues_labels.rb @@ -1,27 +1,26 @@ module Gitlab class IssuesLabels class << self - def important_labels - %w(bug critical confirmed) - end - - def warning_labels - %w(documentation support) - end - - def neutral_labels - %w(discussion suggestion) - end - - def positive_labels - %w(feature enhancement) - end - def generate(project) - label_names = important_labels + warning_labels + neutral_labels + positive_labels + red = '#d9534f' + yellow = '#f0ad4e' + blue = '#428bca' + green = '#5cb85c' + + labels = [ + { title: "bug", color: red }, + { title: "critical", color: red }, + { title: "confirmed", color: red }, + { title: "documentation", color: yellow }, + { title: "support", color: yellow }, + { title: "discussion", color: blue }, + { title: "suggestion", color: blue }, + { title: "feature", color: green }, + { title: "enhancement", color: green } + ] - label_names.each do |label_name| - project.labels.create(title: label_name) + labels.each do |label| + project.labels.create(label) end end end |