diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox
index e632ac653..00cc5d4ae 100644
--- a/UI/Templates/MailerUI/UIxMailMainFrame.wox
+++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox
@@ -341,24 +341,82 @@
+
arrow_back
diff --git a/UI/WebServerResources/js/Mailer/Mailbox.service.js b/UI/WebServerResources/js/Mailer/Mailbox.service.js
index d802f3107..49f5247e7 100644
--- a/UI/WebServerResources/js/Mailer/Mailbox.service.js
+++ b/UI/WebServerResources/js/Mailer/Mailbox.service.js
@@ -170,19 +170,19 @@
* @param {string} sort.match - either AND or OR
* @param {string} sort.sort - either arrival, subject, from, to, date, or size
* @param {boolean} sort.asc - sort is ascendant if true
- * @param {object[]} [filers] - list of filters for the query
- * @param {string} filers.searchBy - either subject, from, to, cc, or body
- * @param {string} filers.searchInput - the search string to match
- * @param {boolean} filers.negative - negate the condition
+ * @param {object[]} [filters] - list of filters for the query
+ * @param {string} filters.searchBy - either subject, from, to, cc, or body
+ * @param {string} filters.searchInput - the search string to match
+ * @param {boolean} filters.negative - negate the condition
* @returns a promise of the HTTP operation
*/
Mailbox.prototype.$filter = function(sort, filters) {
var futureMailboxData, options;
- if (angular.isUndefined(sort)) {
- sort = { sortingAttributes: { match: 'OR', sort: 'date', asc: false } };
+ if (sort) {
+ angular.extend(this.$query, sort);
}
- options = { sortingAttributes: sort };
+ options = { sortingAttributes: this.$query };
if (angular.isDefined(filters)) {
options.filters = _.reject(filters, function(filter) {
return angular.isUndefined(filter.searchInput) || filter.searchInput.length == 0;
@@ -474,6 +474,7 @@
angular.extend(_this, data);
_this.$messages = [];
_this.uidsMap = {};
+ _this.$query = { sortingAttributes: { match: 'OR', sort: 'date', asc: false } };
if (_this.uids) {
Mailbox.$log.debug('unwrapping ' + data.uids.length + ' messages');
diff --git a/UI/WebServerResources/js/Mailer/MailboxController.js b/UI/WebServerResources/js/Mailer/MailboxController.js
index 94d55986c..2ad6319e1 100644
--- a/UI/WebServerResources/js/Mailer/MailboxController.js
+++ b/UI/WebServerResources/js/Mailer/MailboxController.js
@@ -20,6 +20,10 @@
vm.confirmDeleteSelectedMessages = confirmDeleteSelectedMessages;
vm.copySelectedMessages = copySelectedMessages;
// vm.moveSelectedMessages = moveSelectedMessages;
+ vm.sort = sort;
+ vm.sortedBy = sortedBy;
+ vm.cancelSearch = cancelSearch;
+ vm.mode = { search: false };
function selectMessage(message) {
$state.go('mail.account.mailbox.message', {accountId: stateAccount.id, mailboxId: encodeUriFilter(stateMailbox.path), messageId: message.uid});
@@ -62,6 +66,19 @@
// vm.selectedFolder.$messages = _.difference(vm.selectedFolder.$messages, selectedMessages);
// });
// }
+
+ function sort(field) {
+ vm.selectedFolder.$filter({ sort: field });
+ }
+
+ function sortedBy(field) {
+ return vm.selectedFolder.$query.sortingAttributes.sort == field;
+ }
+
+ function cancelSearch() {
+ vm.mode.search = false;
+ vm.selectedFolder.$filter();
+ }
}
angular