Merge pull request #213 from whiteout-io/dev/WO-770

Broadcast search event from action bar to filter mail-list
This commit is contained in:
Felix Hammerl 2014-12-01 18:10:00 +01:00
commit c3b3efa696
2 changed files with 15 additions and 1 deletions

View File

@ -156,6 +156,13 @@ var ActionBarCtrl = function($scope, email, dialog, statusDisplay) {
return message.checked; return message.checked;
}); });
} }
/**
* This method is called when the user changes the searchText
*/
$scope.displaySearchResults = function(searchText) {
$scope.$root.$broadcast('search', searchText);
};
}; };
module.exports = ActionBarCtrl; module.exports = ActionBarCtrl;

View File

@ -105,7 +105,7 @@ var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDispl
var now = new Date(); var now = new Date();
// return time if mail is from today // return time if mail is from today
if(now.getDay() === date.getDay() && now.getMonth() === date.getMonth() && now.getFullYear() === date.getFullYear()) { if (now.getDay() === date.getDay() && now.getMonth() === date.getMonth() && now.getFullYear() === date.getFullYear()) {
return $filter('date')(date, 'shortTime'); return $filter('date')(date, 'shortTime');
} }
@ -177,6 +177,13 @@ var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDispl
Array.prototype.push.apply($scope.displayMessages, next); Array.prototype.push.apply($scope.displayMessages, next);
}; };
/**
* Handle search event in other parts of the app by filtering messages in the mail-list
*/
$scope.$on('search', function(e, query) {
$scope.displaySearchResults(query);
});
/** /**
* This method is called when the user changes the searchText * This method is called when the user changes the searchText
*/ */