(js) Ask to reload the page when changing language

This commit is contained in:
Francis Lachapelle
2015-11-24 14:57:40 -05:00
parent 9a12fb24a6
commit 333d279246
2 changed files with 34 additions and 20 deletions
@@ -7,14 +7,15 @@
/**
* @ngInject
*/
PreferencesController.$inject = ['$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) {
PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdDialog, $mdToast, Dialog, User, Account, statePreferences, Authentication) {
var vm = this, account, mailboxes = [];
vm.preferences = statePreferences;
vm.passwords = { newPassword: null, newPasswordConfirmation: null };
vm.go = go;
vm.onLanguageChange = onLanguageChange;
vm.addCalendarCategory = addCalendarCategory;
vm.removeCalendarCategory = removeCalendarCategory;
vm.addContactCategory = addContactCategory;
@@ -52,6 +53,17 @@
$state.go('preferences.' + module);
}
function onLanguageChange() {
Dialog.confirm(l('Warning'),
l('Save preferences and reload page now?'),
{ok: l('Yes'), cancel: l('No')})
.then(function() {
save().then(function() {
$window.location.reload(true);
});
});
}
function addCalendarCategory() {
vm.preferences.defaults.SOGoCalendarCategoriesColors["New category"] = "#aaa";
vm.preferences.defaults.SOGoCalendarCategories.push("New category");