1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 02:42:17 -05:00

Broadcast search event from action bar to filter mail-list

This commit is contained in:
Tankred Hase 2014-12-01 17:33:09 +01:00
parent 4edf79d8c4
commit e8e69ad32d
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;
});
}
/**
* This method is called when the user changes the searchText
*/
$scope.displaySearchResults = function(searchText) {
$scope.$root.$broadcast('search', searchText);
};
};
module.exports = ActionBarCtrl;

View File

@ -105,7 +105,7 @@ var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDispl
var now = new Date();
// 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');
}
@ -177,6 +177,13 @@ var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDispl
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
*/