mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-13 15:57:12 +00:00
Initial work for muliple selections + new toolbar with ops
This commit is contained in:
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
|
||||
|
||||
@@ -55,7 +55,27 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$scope.notSelectedComponent = function(currentCard, type) {
|
||||
return (currentCard.tag == type && !currentCard.selected);
|
||||
};
|
||||
|
||||
$scope.unselectCards = function() {
|
||||
_.each($rootScope.currentFolder.cards, function(card) { card.selected = false; });
|
||||
};
|
||||
|
||||
$scope.confirmDeleteSelectedCards = function() {
|
||||
Dialog.confirm(l('Warning'),
|
||||
l('Are you sure you want to delete the selected contacts?'))
|
||||
.then(function() {
|
||||
// User confirmed the deletion
|
||||
var selectedCards = _.filter($rootScope.currentFolder.cards, function(card) { return card.selected });
|
||||
$rootScope.currentFolder.$deleteCards(selectedCards);
|
||||
}, function(data, status) {
|
||||
// Delete failed
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
angular
|
||||
.module('SOGo.ContactsUI')
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
// The promise will be unwrapped first
|
||||
this.$unwrap(futureCardData);
|
||||
}
|
||||
|
||||
this.selected = false;
|
||||
}
|
||||
|
||||
Card.$TEL_TYPES = ['work', 'home', 'cell', 'fax', 'pager'];
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
};
|
||||
$scope.doDelete = function() {
|
||||
stateMailbox.$deleteMessages([stateMessage.uid]).then(function() {
|
||||
// Remove card from list of addressbook
|
||||
// Remove message from list of messages
|
||||
stateMailbox.$messages = _.reject(stateMailbox.$messages, function(o) {
|
||||
return o.uid == stateMessage.uid;
|
||||
});
|
||||
// Remove card object from scope
|
||||
// Remove message object from scope
|
||||
$rootScope.message = null;
|
||||
$state.go('mail.account.mailbox', { accountId: stateAccount.id, mailboxId: encodeUriFilter(stateMailbox.path) });
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user