Commit be68cc461755752697642c58154781ae4ec9ab31
1 parent
9d668750
Exists in
master
and in
4 other branches
add Gitlab::Label class and different color labels for default labels set
Showing
3 changed files
with
45 additions
and
1 deletions
Show diff stats
app/helpers/issues_helper.rb
| ... | ... | @@ -88,4 +88,19 @@ module IssuesHelper |
| 88 | 88 | "" |
| 89 | 89 | end |
| 90 | 90 | end |
| 91 | + | |
| 92 | + def label_css_class(name) | |
| 93 | + case name | |
| 94 | + when *warning_labels | |
| 95 | + 'label-warning' | |
| 96 | + when *neutral_labels | |
| 97 | + 'label-inverse' | |
| 98 | + when *positive_labels | |
| 99 | + 'label-success' | |
| 100 | + when *important_labels | |
| 101 | + 'label-important' | |
| 102 | + else | |
| 103 | + 'label-info' | |
| 104 | + end | |
| 105 | + end | |
| 91 | 106 | end | ... | ... |
app/views/issues/_issue.html.haml
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +module Gitlab | |
| 2 | + class Labels | |
| 3 | + class << self | |
| 4 | + def important_labels | |
| 5 | + %w(bug critical confirmed) | |
| 6 | + end | |
| 7 | + | |
| 8 | + def warning_labels | |
| 9 | + %w(documentation support) | |
| 10 | + end | |
| 11 | + | |
| 12 | + def neutral_labels | |
| 13 | + %w(discussion suggestion) | |
| 14 | + end | |
| 15 | + | |
| 16 | + def positive_labels | |
| 17 | + %w(feature enhancement) | |
| 18 | + end | |
| 19 | + | |
| 20 | + def self.generate(project) | |
| 21 | + labels = important_labels + warning_labels + neutral_labels + positive_labels | |
| 22 | + | |
| 23 | + labels.each do |label_name| | |
| 24 | + # create tag for project | |
| 25 | + end | |
| 26 | + end | |
| 27 | + end | |
| 28 | + end | |
| 29 | +end | ... | ... |