Apply labels only if we picked a label from the dropdown
This commit is contained in:
parent
1e96e7f6d2
commit
618cf373ca
2 changed files with 26 additions and 4 deletions
|
@ -7,11 +7,25 @@ class @IssuableBulkActions
|
||||||
@issues = @getElement('.issues-list .issue')
|
@issues = @getElement('.issues-list .issue')
|
||||||
} = opts
|
} = opts
|
||||||
|
|
||||||
|
# Save instance
|
||||||
|
@form.data 'bulkActions', @
|
||||||
|
|
||||||
|
@disableWillUpdate()
|
||||||
|
|
||||||
@bindEvents()
|
@bindEvents()
|
||||||
|
|
||||||
# Fixes bulk-assign not working when navigating through pages
|
# Fixes bulk-assign not working when navigating through pages
|
||||||
Issuable.initChecks();
|
Issuable.initChecks();
|
||||||
|
|
||||||
|
enableWillUpdate: ->
|
||||||
|
@toggleWillUpdate(true)
|
||||||
|
|
||||||
|
disableWillUpdate: ->
|
||||||
|
@toggleWillUpdate(false)
|
||||||
|
|
||||||
|
toggleWillUpdate: (enable)->
|
||||||
|
@willUpdateLabels = if enable? then enable else not @willUpdateLabels
|
||||||
|
|
||||||
getElement: (selector) ->
|
getElement: (selector) ->
|
||||||
@container.find selector
|
@container.find selector
|
||||||
|
|
||||||
|
@ -87,11 +101,12 @@ class @IssuableBulkActions
|
||||||
add_label_ids : []
|
add_label_ids : []
|
||||||
remove_label_ids : []
|
remove_label_ids : []
|
||||||
|
|
||||||
@getLabelsToApply().map (id) ->
|
if @willUpdateLabels
|
||||||
formData.update.add_label_ids.push id
|
@getLabelsToApply().map (id) ->
|
||||||
|
formData.update.add_label_ids.push id
|
||||||
|
|
||||||
@getLabelsToRemove().map (id) ->
|
@getLabelsToRemove().map (id) ->
|
||||||
formData.update.remove_label_ids.push id
|
formData.update.remove_label_ids.push id
|
||||||
|
|
||||||
formData
|
formData
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,8 @@ class @LabelsSelect
|
||||||
|
|
||||||
multiSelect: $dropdown.hasClass 'js-multiselect'
|
multiSelect: $dropdown.hasClass 'js-multiselect'
|
||||||
clicked: (label) ->
|
clicked: (label) ->
|
||||||
|
_this.enableBulkLabelDropdown()
|
||||||
|
|
||||||
if $dropdown.hasClass('js-filter-bulk-update')
|
if $dropdown.hasClass('js-filter-bulk-update')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -377,3 +379,8 @@ class @LabelsSelect
|
||||||
label_ids.push $("#issue_#{issue_id}").data('labels')
|
label_ids.push $("#issue_#{issue_id}").data('labels')
|
||||||
|
|
||||||
_.intersection.apply _, label_ids
|
_.intersection.apply _, label_ids
|
||||||
|
|
||||||
|
enableBulkLabelDropdown: ->
|
||||||
|
if $('.selected_issue:checked').length
|
||||||
|
issuableBulkActions = $('.bulk-update').data('bulkActions')
|
||||||
|
issuableBulkActions.enableWillUpdate()
|
||||||
|
|
Loading…
Reference in a new issue