Show current ordering setting in lists

This commit is contained in:
Francis Lachapelle
2018-05-07 16:43:16 -04:00
parent 71d48dd6b5
commit 12b2ecca72
8 changed files with 112 additions and 32 deletions
@@ -8,7 +8,17 @@
*/
AddressBookController.$inject = ['$scope', '$q', '$window', '$state', '$timeout', '$mdDialog', '$mdToast', 'Account', 'Card', 'AddressBook', 'sgFocus', 'Dialog', 'sgSettings', 'sgHotkeys', 'stateAddressbooks', 'stateAddressbook'];
function AddressBookController($scope, $q, $window, $state, $timeout, $mdDialog, $mdToast, Account, Card, AddressBook, focus, Dialog, Settings, sgHotkeys, stateAddressbooks, stateAddressbook) {
var vm = this, hotkeys = [];
var vm = this, hotkeys = [], sortLabels;
sortLabels = {
c_cn: 'Name',
c_sn: 'Lastname',
c_givenname: 'Firstname',
c_mail: 'Email',
c_screenname: 'Screen Name',
c_o: 'Organization',
c_telephonenumber: 'Preferred Phone'
};
this.$onInit = function() {
AddressBook.selectedFolder = stateAddressbook;
@@ -296,13 +306,22 @@
};
this.sort = function(field) {
this.selectedFolder.$filter('', { sort: field });
if (field) {
this.selectedFolder.$filter('', { sort: field });
}
else {
return sortLabels[AddressBook.$query.sort];
}
};
this.sortedBy = function(field) {
return AddressBook.$query.sort == field;
};
this.ascending = function() {
return AddressBook.$query.asc;
};
this.searchMode = function() {
vm.mode.search = true;
focus('search');
@@ -10,7 +10,16 @@
function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, sgHotkeys, encodeUriFilter, sgSettings, focus, Dialog, Preferences, Account, Mailbox) {
var vm = this,
defaultWindowTitle = angular.element($window.document).find('title').attr('sg-default') || "SOGo",
hotkeys = [];
hotkeys = [],
sortLabels;
sortLabels = {
subject: 'Subject',
from: 'From',
date: 'Date',
size: 'Size',
arrival: 'Order Received'
};
this.$onInit = function() {
// Expose controller for eventual popup windows
@@ -123,13 +132,22 @@
};
this.sort = function(field) {
vm.selectedFolder.$filter({ sort: field });
if (field) {
vm.selectedFolder.$filter({ sort: field });
}
else {
return sortLabels[vm.service.$query.sort];
}
};
this.sortedBy = function(field) {
return Mailbox.$query.sort == field;
};
this.ascending = function() {
return Mailbox.$query.asc;
};
this.searchMode = function() {
vm.mode.search = true;
focus('search');
@@ -8,7 +8,23 @@
*/
CalendarListController.$inject = ['$rootScope', '$scope', '$q', '$timeout', '$state', '$mdDialog', 'sgHotkeys', 'sgFocus', 'Dialog', 'Preferences', 'CalendarSettings', 'Calendar', 'Component', 'Alarm'];
function CalendarListController($rootScope, $scope, $q, $timeout, $state, $mdDialog, sgHotkeys, focus, Dialog, Preferences, CalendarSettings, Calendar, Component, Alarm) {
var vm = this, hotkeys = [], type;
var vm = this, hotkeys = [], type, sortLabels;
sortLabels = {
title: 'Title',
location: 'Location',
calendarName: 'Calendar',
start: 'Start',
priority: 'Priority',
category: 'Category',
status: 'Status',
events: {
end: 'End'
},
tasks: {
end: 'Due Date'
}
};
vm.component = Component;
vm.componentType = 'events';
@@ -22,7 +38,6 @@
vm.openEvent = openEvent;
vm.openTask = openTask;
vm.newComponent = newComponent;
vm.filterpopup = filterpopup;
vm.filter = filter;
vm.filteredBy = filteredBy;
vm.sort = sort;
@@ -350,12 +365,13 @@
}
}
function filterpopup() {
return Component['$query' + vm.componentType.capitalize()].filterpopup;
}
function filter(filterpopup) {
Component.$filter(vm.componentType, { filterpopup: filterpopup });
if (filterpopup) {
Component.$filter(vm.componentType, { filterpopup: filterpopup });
}
else {
return Component['$query' + vm.componentType.capitalize()].filterpopup;
}
}
function filteredBy(filterpopup) {
@@ -363,13 +379,23 @@
}
function sort(field) {
Component.$filter(vm.componentType, { sort: field });
if (field) {
Component.$filter(vm.componentType, { sort: field });
}
else {
var sort = Component['$query' + vm.componentType.capitalize()].sort;
return sortLabels[sort] || sortLabels[vm.componentType][sort];
}
}
function sortedBy(field) {
return Component['$query' + vm.componentType.capitalize()].sort == field;
}
this.ascending = function() {
return Component['$query' + vm.componentType.capitalize()].asc;
};
function reload() {
Calendar.reloadWebCalendars().finally(function() {
$rootScope.$emit('calendars:list');