diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-05-06 01:10:12 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-04 01:14:23 +0300 |
commit | f02ee98697ba2829bf092d662c24e2e553832fe9 (patch) | |
tree | 8478bb17e10812c1dfa4a2ce917d1927cc2ca733 /app/assets/javascripts/labels_select.js.coffee | |
parent | 151158f1d775de477a767fd93c34197d9349cd1a (diff) |
Tweaks for bulk assignment
Diffstat (limited to 'app/assets/javascripts/labels_select.js.coffee')
-rw-r--r-- | app/assets/javascripts/labels_select.js.coffee | 18 |
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) -> |