mirror of
https://github.com/moparisthebest/mail
synced 2025-02-18 07:50:34 -05:00
Broadcast search event from action bar to filter mail-list
This commit is contained in:
parent
4edf79d8c4
commit
e8e69ad32d
@ -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;
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user