(fix) XSRF supprot for all contact operations

This commit is contained in:
Ludovic Marcotte
2016-05-04 14:15:18 -04:00
parent d4fc1775b2
commit 5f2a862bc8
8 changed files with 37 additions and 22 deletions

View File

@@ -632,6 +632,23 @@
});
};
/**
* @function $exportCards
* @memberof AddressBook.prototype
* @desc Export the selected/all cards
* @returns a promise of the HTTP operation
*/
AddressBook.prototype.exportCards = function(selectedOnly) {
var selectedUIDs;
if (selectedOnly) {
var selectedCards = _.filter(this.$cards, function(card) { return card.selected; });
selectedUIDs = _.map(selectedCards, 'id');
}
return AddressBook.$$resource.download(this.id, 'export', (angular.isDefined(selectedUIDs) ? {uids: selectedUIDs} : null), {type: 'application/octet-stream'});
};
/**
* @function $unwrap
* @memberof AddressBook.prototype