Initial work for muliple selections + new toolbar with ops

This commit is contained in:
Ludovic Marcotte authored and Francis Lachapelle committed 2015-06-12 12:02:16 -04:00
1 parent 499e66ffe9
commit 7d54bd5e86
9 files changed
+95 -19

No files matched your search

@@ -71,6 +71,16 @@
});
};
AddressBook.prototype.$selectedCount = function() {
var count;
count = 0;
if (this.cards) {
count = (_.filter(this.cards, function(card) { return card.selected })).length;
}
return count;
};
/**
* @memberof AddressBook
* @desc Add a new addressbook to the static list of addressbooks
@@ -264,6 +274,22 @@
return d.promise;
};
/**
* @function $deleteCards
* @memberof AddressBook.prototype
* @desc Delete multiple cards from addressbook.
* @return a promise of the HTTP operation
*/
AddressBook.prototype.$deleteCards = function(cards) {
var uids = _.map(cards, function(card) { return card.id });
var _this = this;
return AddressBook.$$resource.post(this.id, 'batchDelete', {uids: uids}).then(function() {
_this.cards = _.difference(_this.cards, cards);
});
};
/**
* @function $save
* @memberof AddressBook.prototype