From 80533a6f9a0f680fdf9fb2af3479285565b75339 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 18 Dec 2015 11:43:05 -0500 Subject: [PATCH] (js) Automatically close sidenav on small devices --- .../js/Contacts/AddressBooksController.js | 2 +- .../js/Preferences/PreferencesController.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/UI/WebServerResources/js/Contacts/AddressBooksController.js b/UI/WebServerResources/js/Contacts/AddressBooksController.js index 85d833788..203954265 100644 --- a/UI/WebServerResources/js/Contacts/AddressBooksController.js +++ b/UI/WebServerResources/js/Contacts/AddressBooksController.js @@ -31,7 +31,7 @@ vm.editMode = false; AddressBook.$query.value = ''; // Close sidenav on small devices - if ($mdMedia('sm')) + if ($mdMedia('xs')) $mdSidenav('left').close(); $state.go('app.addressbook', {addressbookId: folder.id}); } diff --git a/UI/WebServerResources/js/Preferences/PreferencesController.js b/UI/WebServerResources/js/Preferences/PreferencesController.js index 9e3dd667f..cfe8ed34f 100644 --- a/UI/WebServerResources/js/Preferences/PreferencesController.js +++ b/UI/WebServerResources/js/Preferences/PreferencesController.js @@ -7,8 +7,8 @@ /** * @ngInject */ - PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; - function PreferencesController($q, $window, $state, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) { + PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; + function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) { var vm = this, account, mailboxes = []; vm.preferences = statePreferences; @@ -56,6 +56,9 @@ }); function go(module) { + // Close sidenav on small devices + if ($mdMedia('xs')) + $mdSidenav('left').close(); $state.go('preferences.' + module); }