add Gitlab::Label class and different color labels for default labels set
This commit is contained in:
parent
9d66875069
commit
be68cc4617
3 changed files with 45 additions and 1 deletions
|
@ -88,4 +88,19 @@ module IssuesHelper
|
|||
""
|
||||
end
|
||||
end
|
||||
|
||||
def label_css_class(name)
|
||||
case name
|
||||
when *warning_labels
|
||||
'label-warning'
|
||||
when *neutral_labels
|
||||
'label-inverse'
|
||||
when *positive_labels
|
||||
'label-success'
|
||||
when *important_labels
|
||||
'label-important'
|
||||
else
|
||||
'label-info'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
.issue-labels
|
||||
- issue.labels.each do |label|
|
||||
%span.label.label-info
|
||||
%span{class: "label #{label_css_class(label.name)}"}
|
||||
%i.icon-tag
|
||||
= label.name
|
||||
|
||||
|
|
29
lib/gitlab/labels.rb
Normal file
29
lib/gitlab/labels.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
module Gitlab
|
||||
class Labels
|
||||
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 self.generate(project)
|
||||
labels = important_labels + warning_labels + neutral_labels + positive_labels
|
||||
|
||||
labels.each do |label_name|
|
||||
# create tag for project
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue