(js) Replace vs-repeat by md-virtual-repeat

There're some issues with mdVirtualRepeat that required some changes to
our app:

1. Having multiple directives with md-virtual-repeat doesn't work well.
That why I added a dedicated div for the md-virtual-repeat directive.
2. ui-sref-active doesn't work well for child nodes of the
md-virtual-repeat element. The class was applied repetitively to a
visible child. I now save which message or card is selected and use the
ng-class directive to highlight the selected list item.
This commit is contained in:
Francis Lachapelle
2015-07-15 13:44:17 -04:00
parent dbb8acca9a
commit 730b803ad6
18 changed files with 149 additions and 153 deletions
+2 -1
View File
@@ -6,7 +6,7 @@
angular.module('SOGo.Common', []);
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'vs-repeat', 'SOGo.Common'])
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'SOGo.Common'])
.constant('sgSettings', {
baseURL: ApplicationBaseURL,
@@ -135,6 +135,7 @@
*/
stateCard.$inject = ['$stateParams', 'stateAddressbook'];
function stateCard($stateParams, stateAddressbook) {
stateAddressbook.selectedCard = $stateParams.cardId;
return stateAddressbook.$getCard($stateParams.cardId);
}
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
AddressBookController.$inject = ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook'];
function AddressBookController($state, $scope, $rootScope, $stateParams, $timeout, $mdDialog, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) {
AddressBookController.$inject = ['$state', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook'];
function AddressBookController($state, $mdDialog, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) {
var vm = this;
AddressBook.selectedFolder = stateAddressbook;
@@ -63,7 +63,7 @@
}
function notSelectedComponent(currentCard, type) {
return (currentCard.tag == type && !currentCard.selected);
return (currentCard && currentCard.tag == type && !currentCard.selected);
}
function unselectCards() {
+6 -3
View File
@@ -6,7 +6,7 @@
angular.module('SOGo.ContactsUI', []);
angular.module('SOGo.MailerUI', ['ngSanitize', 'ui.router', 'vs-repeat', 'ck', 'angularFileUpload', 'SOGo.Common', 'SOGo.ContactsUI', 'ngAnimate'])
angular.module('SOGo.MailerUI', ['ngSanitize', 'ui.router', 'ck', 'angularFileUpload', 'SOGo.Common', 'SOGo.ContactsUI', 'ngAnimate'])
.constant('sgSettings', {
baseURL: ApplicationBaseURL,
@@ -204,11 +204,14 @@
return messageObject.uid == $stateParams.messageId;
});
if (message)
if (message) {
stateMailbox.selectedMessage = $stateParams.messageId;
return message.$reload();
else
}
else {
// Message not found
$state.go('mail.account.mailbox', { accountId: stateMailbox.$account.id, mailboxId: encodeUriFilter(stateMailbox.path) });
}
}
/**
@@ -20,7 +20,7 @@
vm.confirmDeleteSelectedMessages = confirmDeleteSelectedMessages;
vm.copySelectedMessages = copySelectedMessages;
// vm.moveSelectedMessages = moveSelectedMessages;
function selectMessage(message) {
$state.go('mail.account.mailbox.message', {accountId: stateAccount.id, mailboxId: encodeUriFilter(stateMailbox.path), messageId: message.uid});
}
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
MailboxesController.$inject = ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$mdDialog', 'sgFocus', 'encodeUriFilter', 'Dialog', 'sgSettings', 'Account', 'Mailbox', 'User', 'stateAccounts'];
function MailboxesController($scope, $rootScope, $stateParams, $state, $timeout, $mdDialog, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, User, stateAccounts) {
MailboxesController.$inject = ['$state', '$timeout', '$mdDialog', 'sgFocus', 'encodeUriFilter', 'Dialog', 'sgSettings', 'Account', 'Mailbox', 'User', 'stateAccounts'];
function MailboxesController($state, $timeout, $mdDialog, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, User, stateAccounts) {
var vm = this,
account,
mailbox;
@@ -179,8 +179,8 @@
/**
* @ngInject
*/
MailboxACLController.$inject = ['$scope', '$mdDialog', 'usersWithACL', 'User', 'folder'];
function MailboxACLController($scope, $mdDialog, usersWithACL, User, folder) {
MailboxACLController.$inject = ['$mdDialog', 'usersWithACL', 'User', 'folder'];
function MailboxACLController($mdDialog, usersWithACL, User, folder) {
var vm = this;
vm.users = usersWithACL; // ACL users
+1 -1
View File
@@ -8,7 +8,7 @@
angular.module('SOGo.MailerUI', []);
angular.module('SOGo.PreferencesUI', []);
angular.module('SOGo.SchedulerUI', ['ngSanitize', 'ui.router', 'ct.ui.router.extras.sticky', 'ct.ui.router.extras.previous', 'vs-repeat', 'SOGo.Common', 'SOGo.ContactsUI', 'SOGo.MailerUI', 'SOGo.PreferencesUI'])
angular.module('SOGo.SchedulerUI', ['ngSanitize', 'ui.router', 'ct.ui.router.extras.sticky', 'ct.ui.router.extras.previous', 'SOGo.Common', 'SOGo.ContactsUI', 'SOGo.MailerUI', 'SOGo.PreferencesUI'])
.constant('sgSettings', {
baseURL: ApplicationBaseURL,