(js) Fix breakpoints consistency

This commit is contained in:
Francis Lachapelle
2016-05-18 14:35:24 -04:00
parent 33ca545f8b
commit 045013bc74
13 changed files with 38 additions and 31 deletions
@@ -110,17 +110,19 @@
})
// md break-points values are hard-coded in angular-material/src/core/util/constant.js
// $mdMedia has a built-in support for those values but can also evaluate others
// $mdMedia has a built-in support for those values but can also evaluate others.
// The following breakpoints match our CSS breakpoints in scss/core/variables.scss
.constant('sgConstant', {
'xs' : '(max-width: 599px)' ,
'gt-xs' : '(min-width: 600px)' ,
'sm' : '(min-width: 600px) and (max-width: 959px)' ,
'gt-sm' : '(min-width: 960px)' ,
'md' : '(min-width: 960px) and (max-width: 1279px)' ,
'gt-md' : '(min-width: 1280px)' ,
'lg' : '(min-width: 1280px) and (max-width: 1919px)',
'gt-lg' : '(min-width: 1920px)' ,
'xl' : '(min-width: 1920px)'
'md' : '(min-width: 960px) and (max-width: 1023px)' ,
'gt-md' : '(min-width: 1024px)' ,
'lg' : '(min-width: 1024px) and (max-width: 1279px)',
'gt-lg' : '(min-width: 1280px)' ,
'xl' : '(min-width: 1920px)' ,
'print' : 'print'
})
.config(configure)
@@ -15,7 +15,7 @@
$scope.isPopup = sgSettings.isPopup;
$scope.activeUser = sgSettings.activeUser();
$scope.baseURL = sgSettings.baseURL();
$scope.leftIsClose = $mdMedia(sgConstant.xs);
$scope.leftIsClose = !$mdMedia(sgConstant['gt-md']);
// Show current day in top bar
$scope.currentDay = window.currentDay;
@@ -58,7 +58,7 @@
// detail.toggleClass('sg-close');
// };
$scope.$watch(function() {
return $mdMedia(sgConstant['gt-sm']);
return $mdMedia(sgConstant['gt-md']);
}, function(newVal) {
$scope.isGtMedium = newVal;
if (newVal) {
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
AddressBooksController.$inject = ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$window', '$mdDialog', '$mdToast', '$mdMedia', '$mdSidenav', 'FileUploader', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'User', 'stateAddressbooks'];
function AddressBooksController($state, $scope, $rootScope, $stateParams, $timeout, $window, $mdDialog, $mdToast, $mdMedia, $mdSidenav, FileUploader, focus, Card, AddressBook, Dialog, Settings, User, stateAddressbooks) {
AddressBooksController.$inject = ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$window', '$mdDialog', '$mdToast', '$mdMedia', '$mdSidenav', 'FileUploader', 'sgConstant', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'User', 'stateAddressbooks'];
function AddressBooksController($state, $scope, $rootScope, $stateParams, $timeout, $window, $mdDialog, $mdToast, $mdMedia, $mdSidenav, FileUploader, sgConstant, focus, Card, AddressBook, Dialog, Settings, User, stateAddressbooks) {
var vm = this;
vm.activeUser = Settings.activeUser;
@@ -30,7 +30,7 @@
vm.editMode = false;
AddressBook.$query.value = '';
// Close sidenav on small devices
if ($mdMedia('xs'))
if (!$mdMedia(sgConstant['gt-md']))
$mdSidenav('left').close();
$state.go('app.addressbook', {addressbookId: folder.id});
}
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
MailboxesController.$inject = ['$state', '$timeout', '$mdDialog', '$mdToast', '$mdMedia', '$mdSidenav', 'sgFocus', 'encodeUriFilter', 'Dialog', 'sgSettings', 'Account', 'Mailbox', 'VirtualMailbox', 'User', 'Preferences', 'stateAccounts'];
function MailboxesController($state, $timeout, $mdDialog, $mdToast, $mdMedia, $mdSidenav, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, VirtualMailbox, User, Preferences, stateAccounts) {
MailboxesController.$inject = ['$state', '$timeout', '$mdDialog', '$mdToast', '$mdMedia', '$mdSidenav', 'sgConstant', 'sgFocus', 'encodeUriFilter', 'Dialog', 'sgSettings', 'Account', 'Mailbox', 'VirtualMailbox', 'User', 'Preferences', 'stateAccounts'];
function MailboxesController($state, $timeout, $mdDialog, $mdToast, $mdMedia, $mdSidenav, sgConstant, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, VirtualMailbox, User, Preferences, stateAccounts) {
var vm = this,
account,
mailbox;
@@ -55,7 +55,7 @@
vm.showingAdvancedSearch = true;
vm.search.mailbox = path;
// Close sidenav on small devices
if ($mdMedia('xs'))
if (!$mdMedia(sgConstant['gt-md']))
$mdSidenav('left').close();
}
@@ -217,7 +217,7 @@
vm.showingAdvancedSearch = false;
vm.service.$virtualMode = false;
// Close sidenav on small devices
if ($mdMedia('xs'))
if (!$mdMedia(sgConstant['gt-md']))
$mdSidenav('left').close();
$state.go('mail.account.mailbox', { accountId: account.id, mailboxId: encodeUriFilter(folder.path) });
$event.stopPropagation();
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
MessageController.$inject = ['$window', '$scope', '$state', '$mdMedia', '$mdDialog', 'stateAccounts', 'stateAccount', 'stateMailbox', 'stateMessage', 'encodeUriFilter', 'sgSettings', 'sgFocus', 'Dialog', 'Calendar', 'Component', 'Account', 'Mailbox', 'Message'];
function MessageController($window, $scope, $state, $mdMedia, $mdDialog, stateAccounts, stateAccount, stateMailbox, stateMessage, encodeUriFilter, sgSettings, focus, Dialog, Calendar, Component, Account, Mailbox, Message) {
MessageController.$inject = ['$window', '$scope', '$state', '$mdMedia', '$mdDialog', 'sgConstant', 'stateAccounts', 'stateAccount', 'stateMailbox', 'stateMessage', 'encodeUriFilter', 'sgSettings', 'sgFocus', 'Dialog', 'Calendar', 'Component', 'Account', 'Mailbox', 'Message'];
function MessageController($window, $scope, $state, $mdMedia, $mdDialog, sgConstant, stateAccounts, stateAccount, stateMailbox, stateMessage, encodeUriFilter, sgSettings, focus, Dialog, Calendar, Component, Account, Mailbox, Message) {
var vm = this, messageDialog = null, popupWindow = null;
// Expose controller
@@ -192,7 +192,7 @@
}
try {
if (nextMessage && !$mdMedia('xs')) {
if (nextMessage && $mdMedia(sgConstant['gt-md'])) {
state.go('mail.account.mailbox.message', { messageId: nextMessage.uid });
if (nextIndex < mailbox.$topIndex)
mailbox.$topIndex = nextIndex;
@@ -119,7 +119,7 @@
clickOutsideToClose: true,
escapeToClose: true,
template: [
'<md-dialog flex="80" flex-xs="100" aria-label="' + l('View Raw Source') + '">',
'<md-dialog flex="40" flex-sm="80" flex-xs="100" aria-label="' + l('View Raw Source') + '">',
' <md-dialog-content class="md-dialog-content">',
' <pre>',
data,