(js) Improve handling of message flags

We now call the model's methods from the template. Uncluttered the
message controller. Fixed the synchronization of the flags with the
messages list.
This commit is contained in:
Francis Lachapelle committed 2015-06-12 12:02:19 -04:00
1 parent ec123b4512
commit a9ad21b395
5 files changed
+60 -31

No files matched your search

@@ -10,17 +10,6 @@
function MessageController($scope, $rootScope, $stateParams, $state, stateAccount, stateMailbox, stateMessage, $timeout, encodeUriFilter, focus, Dialog, Account, Mailbox) {
$rootScope.message = stateMessage;
$scope.tags = {};
$scope.addOrRemoveTag = function(operation, tag) {
if (tag) {
stateMessage.$addOrRemoveTag(operation, tag);
}
};
$scope.markAsFlaggedOrUnflagged = function() {
var operation = (stateMessage.isflagged ? 'remove' : 'add');
stateMessage.$markAsFlaggedOrUnflagged(operation).then(function() {
stateMessage.isflagged = !stateMessage.isflagged;
});
};
$scope.doDelete = function() {
stateMailbox.$deleteMessages([stateMessage.uid]).then(function() {
// Remove message from list of messages