(js) Improve addressbook renaming

The AddressBook instance to list the cards is now the same as the one
from the list of addressbooks. Therefore, when renaming an addressbook,
the addressbook name in the list is automatically updated.
This commit is contained in:
Francis Lachapelle committed 2015-11-09 14:46:30 -05:00
1 parent dc3e42fd62
commit cc5cc30c24
4 files changed
+23 -14

No files matched your search

@@ -215,10 +215,12 @@
* @desc Extend instance with new data and compute additional attributes.
* @param {object} data - attributes of addressbook
*/
AddressBook.prototype.init = function(data) {
this.$isLoading = true;
this.$cards = [];
this.cards = [];
AddressBook.prototype.init = function(data, options) {
if (!this.$cards) {
this.$isLoading = true;
this.$cards = [];
this.cards = [];
}
angular.extend(this, data);
// Add 'isOwned' and 'isSubscription' attributes based on active user (TODO: add it server-side?)
this.isOwned = AddressBook.activeUser.isSuperUser || this.owner == AddressBook.activeUser.login;