(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 committed 2015-07-15 13:44:17 -04:00
1 parent dbb8acca9a
commit 730b803ad6
18 files changed
+149 -153

No files matched your search

-1
View File
@@ -106,7 +106,6 @@ module.exports = function(grunt) {
'<%= src %>/angular-ui-router/release/angular-ui-router{,.min}.js',
'<%= src %>/ui-router-extras/release/ct-ui-router-extras{,.min}.js',
'<%= src %>/angular-recursion/angular-recursion{,.min}.js',
'<%= src %>/angular-vs-repeat/src/angular-vs-repeat{,.min}.js',
'<%= src %>/angular-file-upload/angular-file-upload{,.min}.js{,map}',
//'<%= src %>/ng-file-upload/ng-file-upload{,.min}.js{,map}',
'<%= src %>/underscore/underscore-min.{js,map}'
-1
View File
@@ -8,7 +8,6 @@
"angular-ui-router": "latest",
"ui-router-extras": "latest",
"angular-recursion": "latest",
"angular-vs-repeat": "latest",
"angular-file-upload": "latest",
"angular-material": "master",
"compass-mixins": "latest",
+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,
@@ -1,22 +1,10 @@
/// autoScrollList.scss -*- Mode: scss; indent-tabs-mode: nil; basic-offset: 2 -*-
@import 'extends';
// The only selector for vs-repeat lists is this id, we use attributes selector to
// avoid overspecifying
// todo: create new classes and refactor templates markup
// ----------------------------------------------------------------------------
.vs-repeat-repeated-element {
width: 100%;
}
[id='messagesList'],
[id='contactsList'] {
border-top: 44px solid transparent; // padding for the header.subheader,
border-bottom: 2px solid transparent; //close to a hack
md-list-item {
// dirty fix for vs-repeat damages
position: absolute;
}
border-bottom: 2px solid transparent; // close to a hack
md-list-item {
transition: background-color $swift-ease-in-duration $swift-ease-in-timing-function,
@@ -0,0 +1,2 @@
/*! virtualRepeat/_extends.scss - */
@import '../../../angular-material/src/components/virtualRepeat/virtualRepeater.scss';
@@ -0,0 +1,9 @@
/// virtualRepeater.scss -*- Mode: scss; indent-tabs-mode: nil; basic-offset: 2 -*-
@import 'extends';
// Override some md styles
.md-virtual-repeat-container {
.md-virtual-repeat-offsetter {
right: 0; // no need to keep space for the scrollbar
}
}
+6 -1
View File
@@ -26,6 +26,7 @@
// Original angular-material components
// ------------------------------------------------------------------------------
@import 'components/autocomplete/autocomplete';
@import 'components/autoScrollList/autoScrollList';
@import 'components/backdrop/backdrop';
@import 'components/bottomSheet/bottomSheet';
@import 'components/button/button';
@@ -35,13 +36,15 @@
@import 'components/content/content';
@import 'components/dialog/dialog';
@import 'components/divider/divider';
//@import 'components/favActions/fabActions';
@import 'components/fabSpeedDial/fabSpeedDial';
//@import 'components/fabToolbar/fabToolbar';
//@import 'components/fabTrigger/fabTrigger';
@import 'components/gridList/gridList';
@import 'components/icon/icon';
@import 'components/input/input';
@import 'components/list/list';
@import 'components/menu/menu';
@import 'components/autoScrollList/autoScrollList';
//@import 'components/progressCircular/progressCircular';
@import 'components/progressLinear/progressLinear';
@import 'components/radioButton/radio-button';
@@ -50,11 +53,13 @@
@import 'components/slider/slider';
@import 'components/sticky/sticky';
@import 'components/subheader/subheader';
//@import 'components/swipe/swipe';
@import 'components/switch/switch';
@import 'components/tabs/tabs';
//@import 'components/toast/toast';
@import 'components/toolbar/toolbar';
@import 'components/tooltip/tooltip';
@import 'components/virtualRepeat/virtualRepeat';
@import 'components/whiteframe/whiteframe';
// Theme
+1 -1
View File
@@ -52,7 +52,7 @@ $detailView-width: grid-step(8) !global;
.view-detail {
z-index: $z-index-view;
overflow-x: hidden;
background-color: $background-base-color;
background-color: transparent;
@include at(md) {
@include flex-col(md, 9);
margin: 0;