summaryrefslogtreecommitdiff
path: root/app/helpers/labels_helper.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-07 19:26:41 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-07 19:26:41 +0300
commit03441769dfc09776eb8511275a3f492ded1a7c42 (patch)
treebfc6ed0dae6c8e73a43eae071daf7b7753acb9a0 /app/helpers/labels_helper.rb
parentbe68cc461755752697642c58154781ae4ec9ab31 (diff)
downloadgitlab-ce-03441769dfc09776eb8511275a3f492ded1a7c42.tar.gz
Include default labels in issues autocomplete etc. Show colored labels on issues show page
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r--app/helpers/labels_helper.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
new file mode 100644
index 00000000000..950db0377eb
--- /dev/null
+++ b/app/helpers/labels_helper.rb
@@ -0,0 +1,28 @@
+module LabelsHelper
+ def issue_tags
+ @project.issues.tag_counts_on(:labels).map(&:name)
+ end
+
+ def labels_autocomplete_source
+ labels = @project.issues_labels
+ labels = labels.map{ |l| { label: l.name, value: l.name } }
+ labels.to_json
+ end
+
+ def label_css_class(name)
+ klass = Gitlab::IssuesLabels
+
+ case name
+ when *klass.warning_labels
+ 'label-warning'
+ when *klass.neutral_labels
+ 'label-inverse'
+ when *klass.positive_labels
+ 'label-success'
+ when *klass.important_labels
+ 'label-important'
+ else
+ 'label-info'
+ end
+ end
+end