Show current ordering setting in lists

pull/241/head
Francis Lachapelle 2018-05-07 16:43:16 -04:00
parent 71d48dd6b5
commit 12b2ecca72
8 changed files with 112 additions and 32 deletions

1
NEWS
View File

@ -3,6 +3,7 @@
Enhancements
- [web] now possible to show events/task for the current year
- [web] show current ordering setting in lists
Bug fixes
- [core] properly update the last-modified attribute (#4313)

View File

@ -280,15 +280,13 @@
<md-menu-item>
<md-button ng-click="addressbook.sort('c_screenname')">
<md-icon ng-class="{ 'icon-check': addressbook.sortedBy('c_screenname') }">
<!-- selected --></md-icon> <var:string
label:value="Screen Name"/>
<!-- selected --></md-icon> <var:string label:value="Screen Name"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="addressbook.sort('c_o')">
<md-icon ng-class="{ 'icon-check': addressbook.sortedBy('c_o') }">
<!-- selected --></md-icon> <var:string
label:value="Organization"/>
<!-- selected --></md-icon> <var:string label:value="Organization"/>
</md-button>
</md-menu-item>
<md-menu-item>
@ -446,10 +444,13 @@
<md-content id="contactsList" layout="column" class="md-flex">
<md-subheader ng-show="addressbook.service.$query.value">
<span ng-switch="addressbook.selectedFolder.$cards.length">
<div ng-switch="addressbook.selectedFolder.$cards.length">
<span ng-switch-when="0"><var:string label:value="No matching contact"/></span>
<span ng-switch-default="true">{{addressbook.selectedFolder.$cards.length}} <var:string label:value="matching contacts"/></span>
</span>
<div ng-switch-default="true" layout="row" layout-align="space-between center">
<div>{{addressbook.selectedFolder.$cards.length}} <var:string label:value="matching contacts"/></div>
<div><md-icon ng-class="{ 'md-flip': addressbook.ascending() }">sort</md-icon> <span ng-bind="addressbook.sort() | loc"><!-- active sort --></span></div>
</div>
</div>
</md-subheader>
<md-subheader ng-hide="addressbook.service.$query.value">
<span ng-switch="addressbook.selectedFolder.listRequiresDot">
@ -459,7 +460,10 @@
<span ng-switch-default="true">
<span ng-switch="addressbook.selectedFolder.$cards.length">
<span ng-switch-when="0"><var:string label:value="No contact"/></span>
<span ng-switch-default="true">{{addressbook.selectedFolder.$cards.length}} <var:string label:value="contacts"/></span>
<div ng-switch-default="true" layout="row" layout-align="space-between center">
<div>{{addressbook.selectedFolder.$cards.length}} <var:string label:value="contacts"/></div>
<div><md-icon ng-class="{ 'md-flip': addressbook.ascending() }">sort</md-icon> <span ng-bind="addressbook.sort() | loc"><!-- active sort --></span></div>
</div>
</span>
</span>
</span>

View File

@ -280,11 +280,14 @@
<md-content id="messagesList" layout="column" class="md-flex">
<md-subheader>
<!-- message count -->
<span ng-switch="mailbox.service.selectedFolder.getLength()">
<span ng-switch-when="0"><var:string label:value="No message"/></span>
<span ng-switch-default="true"><span ng-bind="mailbox.service.selectedFolder.getLength()"><!-- count --></span> <var:string label:value="messages"/></span>
</span>
<div layout="row" layout-align="space-between center">
<div ng-switch="mailbox.service.selectedFolder.getLength()">
<!-- message count -->
<span ng-switch-when="0"><var:string label:value="No message"/></span>
<span ng-switch-default="true"><span ng-bind="mailbox.service.selectedFolder.getLength()"><!-- count --></span> <var:string label:value="messages"/></span>
</div>
<div><md-icon ng-class="{ 'md-flip': mailbox.ascending() }">sort</md-icon> <span ng-bind="mailbox.sort() | loc"><!-- active sort --></span></div>
</div>
</md-subheader>
<md-virtual-repeat-container class="md-flex" md-top-index="mailbox.selectedFolder.$topIndex">
<md-list class="sg-section-list"

View File

@ -209,31 +209,31 @@
</md-menu-item>
<md-menu-item ng-if="list.componentType == 'events'">
<md-button ng-click="list.filter('view_future')">
<md-icon ng-class="{ 'icon-check': list.component.$queryEvents.filterpopup == 'view_future' }">
<md-icon ng-class="{ 'icon-check': list.filteredBy('view_future') }">
<!-- selected --></md-icon> <var:string label:value="view_future"/>
</md-button>
</md-menu-item>
<md-menu-item ng-if="list.componentType == 'events'">
<md-button ng-click="list.filter('view_selectedday')">
<md-icon ng-class="{ 'icon-check': list.component.$queryEvents.filterpopup == 'view_selectedday' }">
<md-icon ng-class="{ 'icon-check': list.filteredBy('view_selectedday') }">
<!-- selected --></md-icon> <var:string label:value="view_selectedday"/>
</md-button>
</md-menu-item>
<md-menu-item ng-if="list.componentType == 'tasks'">
<md-button ng-click="list.filter('view_not_started')">
<md-icon ng-class="{ 'icon-check': list.component.$queryTasks.filterpopup == 'view_not_started' }">
<md-icon ng-class="{ 'icon-check': list.filteredBy('view_not_started') }">
<!-- selected --></md-icon> <var:string label:value="view_not_started"/>
</md-button>
</md-menu-item>
<md-menu-item ng-if="list.componentType == 'tasks'">
<md-button ng-click="list.filter('view_overdue')">
<md-icon ng-class="{ 'icon-check': list.component.$queryTasks.filterpopup == 'view_overdue' }">
<md-icon ng-class="{ 'icon-check': list.filteredBy('view_overdue') }">
<!-- selected --></md-icon> <var:string label:value="view_overdue"/>
</md-button>
</md-menu-item>
<md-menu-item ng-if="list.componentType == 'tasks'">
<md-button ng-click="list.filter('view_incomplete')">
<md-icon ng-class="{ 'icon-check': list.component.$queryTasks.filterpopup == 'view_incomplete' }">
<md-icon ng-class="{ 'icon-check': list.filteredBy('view_incomplete') }">
<!-- selected --></md-icon> <var:string label:value="view_incomplete"/>
</md-button>
</md-menu-item>
@ -386,7 +386,10 @@
<md-tab label:label="Events"
md-on-select="list.selectComponentType('events')">
<md-subheader>
<span ng-bind="list.filterpopup() | loc"><!-- active filter --></span>
<div layout="row" layout-align="space-between center">
<div ng-bind="list.filter() | loc"><!-- active filter --></div>
<div><md-icon ng-class="{ 'md-flip': list.ascending() }">sort</md-icon> <span ng-bind="list.sort() | loc"><!-- active sort --></span></div>
</div>
</md-subheader>
<md-list class="sg-section-list"
ng-class="{ 'sg-list-selectable': list.mode.multiple }"
@ -430,7 +433,10 @@
<md-tab label:label="Tasks"
md-on-select="list.selectComponentType('tasks')">
<md-subheader>
<span>{{list.filterpopup() | loc}}</span>
<div layout="row" layout-align="space-between center">
<div ng-bind="list.filter() | loc"><!-- active filter --></div>
<div><md-icon ng-class="{ 'md-flip': list.ascending() }">sort</md-icon> <span ng-bind="list.sort() | loc"><!-- active sort --></span></div>
</div>
</md-subheader>
<md-list class="sg-section-list"
ng-class="{ 'sg-list-selectable': list.mode.multiple }">

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -84,6 +84,9 @@ md-icon {
&.md-rotate-180-ccw {
transform: rotate(-180deg);
}
&.md-flip {
transform: scaleY(-1);
}
// &.icon-add:before {
// content: "\e317";
// }