diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-22 14:58:38 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-23 06:59:35 -0500 |
commit | 8af08d52f29da791ad3b846ea651bdd4aaf770ec (patch) | |
tree | 07190b4772b515257f3ead3dea6a24c35cc0c872 | |
parent | 63358f57554c84a63aba8084965ae8ba01de1cd7 (diff) | |
download | gitlab-ce-8af08d52f29da791ad3b846ea651bdd4aaf770ec.tar.gz |
Apply labels only if we picked a label from the dropdown
-rw-r--r-- | app/assets/javascripts/issues-bulk-assignment.js.coffee | 23 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js.coffee | 7 |
2 files changed, 26 insertions, 4 deletions
diff --git a/app/assets/javascripts/issues-bulk-assignment.js.coffee b/app/assets/javascripts/issues-bulk-assignment.js.coffee index b454f9389dd..8ca7409f5b4 100644 --- a/app/assets/javascripts/issues-bulk-assignment.js.coffee +++ b/app/assets/javascripts/issues-bulk-assignment.js.coffee @@ -7,11 +7,25 @@ class @IssuableBulkActions @issues = @getElement('.issues-list .issue') } = opts + # Save instance + @form.data 'bulkActions', @ + + @disableWillUpdate() + @bindEvents() # Fixes bulk-assign not working when navigating through pages Issuable.initChecks(); + enableWillUpdate: -> + @toggleWillUpdate(true) + + disableWillUpdate: -> + @toggleWillUpdate(false) + + toggleWillUpdate: (enable)-> + @willUpdateLabels = if enable? then enable else not @willUpdateLabels + getElement: (selector) -> @container.find selector @@ -87,11 +101,12 @@ class @IssuableBulkActions add_label_ids : [] remove_label_ids : [] - @getLabelsToApply().map (id) -> - formData.update.add_label_ids.push id + if @willUpdateLabels + @getLabelsToApply().map (id) -> + formData.update.add_label_ids.push id - @getLabelsToRemove().map (id) -> - formData.update.remove_label_ids.push id + @getLabelsToRemove().map (id) -> + formData.update.remove_label_ids.push id formData diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index 6a10db10eb1..0729d5d91ce 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -319,6 +319,8 @@ class @LabelsSelect multiSelect: $dropdown.hasClass 'js-multiselect' clicked: (label) -> + _this.enableBulkLabelDropdown() + if $dropdown.hasClass('js-filter-bulk-update') return @@ -377,3 +379,8 @@ class @LabelsSelect label_ids.push $("#issue_#{issue_id}").data('labels') _.intersection.apply _, label_ids + + enableBulkLabelDropdown: -> + if $('.selected_issue:checked').length + issuableBulkActions = $('.bulk-update').data('bulkActions') + issuableBulkActions.enableWillUpdate() |