summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/labels_select.js.coffee18
1 files changed, 15 insertions, 3 deletions
diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee
index 52c1e8a469b..eb249e24f67 100644
--- a/app/assets/javascripts/labels_select.js.coffee
+++ b/app/assets/javascripts/labels_select.js.coffee
@@ -237,13 +237,23 @@ class @LabelsSelect
else
colorEl = ''
+ # We need to identify which items are actually labels
+ labelIdHtml = labelClass = ''
+
+ if label.id
+ # Add label id only for labels
+ labelIdHtml = "data-label-id='#{label.id}'"
+
+ # Add class only for labels
+ labelClass = 'label-item'
+
"<li>
- <a href='#' class='#{selectedClass.join(' ')}'>
+ <a href='#' #{labelIdHtml} class='#{labelClass} #{selectedClass.join(' ')}'>
#{colorEl}
#{_.escape(label.title)}
</a>
</li>"
- filterable: true
+ persistWhenHide: $dropdown.data('persistWhenHide')
search:
fields: ['title']
selectable: true
@@ -291,7 +301,9 @@ class @LabelsSelect
saveLabelData()
if $dropdown.hasClass('js-filter-bulk-update')
- $dropdown.parent().find('.is-active, .is-indeterminate').removeClass()
+ # If we are persisting state we need the classes
+ if not @options.persistWhenHide
+ $dropdown.parent().find('.is-active, .is-indeterminate').removeClass()
multiSelect: $dropdown.hasClass 'js-multiselect'
clicked: (label) ->