2013-05-07 12:26:41 -04:00
|
|
|
module LabelsHelper
|
2013-05-08 03:00:19 -04:00
|
|
|
def issue_label_names
|
|
|
|
@project.issues_labels.map(&:name)
|
2013-05-07 12:26:41 -04:00
|
|
|
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
|