1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 14:19:43 +02:00

chained bulk doc delete promises

This commit is contained in:
Harvey Kandola 2017-08-17 18:31:19 +01:00
parent eeb3d8f070
commit 5b70ffd954
4 changed files with 30 additions and 34 deletions

View file

@ -13,7 +13,6 @@ import Ember from 'ember';
export default Ember.Component.extend({
folderService: Ember.inject.service('folder'),
selectedDocuments: [],
moveTarget: null,
emptyState: Ember.computed('documents', function() {
return this.get('documents.length') === 0;
@ -22,20 +21,19 @@ export default Ember.Component.extend({
didReceiveAttrs() {
this._super(...arguments);
this.set('selectedDocuments', []);
this.set('canCreate', this.get('folderService').get('canEditCurrentFolder'));
this.set('deleteTargets', this.get('folders').rejectBy('id', this.get('folder.id')));
},
didUpdateAttrs() {
this._super(...arguments);
this.setupAddWizard();
},
},
didInsertElement() {
this._super(...arguments);
this.setupAddWizard();
},
@ -50,7 +48,7 @@ export default Ember.Component.extend({
// out
$(this).find('.start-button').velocity("transition.slideUpOut", {duration: 300});
} });
});
});
},
actions: {
@ -61,16 +59,12 @@ export default Ember.Component.extend({
doc.set('selected', !doc.get('selected'));
if (doc.get('selected')) {
list.push(documentId);
list.pushObject(documentId);
} else {
var index = list.indexOf(documentId);
if (index > -1) {
list.splice(index, 1);
}
}
list = _.without(list, documentId);
}
this.set('selectedDocuments', list);
this.get('onDocumentsChecked')(list);
this.set('selectedDocuments', list);
},
onDelete() {