mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-10 17:33:25 +00:00
Webmail: add possibility to rename a mailbox
This commit is contained in:
@@ -163,29 +163,10 @@
|
||||
|
||||
.run(function($rootScope) {
|
||||
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
|
||||
console.log(event, current, previous, rejection)
|
||||
console.error(event, current, previous, rejection)
|
||||
})
|
||||
})
|
||||
|
||||
.directive('sgFocusOn', function() {
|
||||
return function(scope, elem, attr) {
|
||||
scope.$on('sgFocusOn', function(e, name) {
|
||||
if (name === attr.sgFocusOn) {
|
||||
elem[0].focus();
|
||||
elem[0].select();
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
|
||||
.factory('sgFocus', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
||||
return function(name) {
|
||||
$timeout(function() {
|
||||
$rootScope.$broadcast('sgFocusOn', name);
|
||||
});
|
||||
}
|
||||
}])
|
||||
|
||||
.controller('MailboxesCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$modal', 'sgFocus', 'encodeUriFilter', 'sgDialog', 'sgAccount', 'sgMailbox', 'stateAccounts', function($scope, $rootScope, $stateParams, $state, $timeout, $modal, focus, encodeUriFilter, Dialog, Account, Mailbox, stateAccounts) {
|
||||
$scope.accounts = stateAccounts;
|
||||
|
||||
@@ -198,6 +179,9 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.editFolder = function(folder) {
|
||||
$rootScope.$broadcast('sgEditFolder', folder.id);
|
||||
};
|
||||
$scope.setCurrentFolder = function(account, folder) {
|
||||
$rootScope.currentFolder = folder;
|
||||
$state.go('mail.account.mailbox', { accountId: account.id, mailboxId: encodeUriFilter(folder.path) });
|
||||
@@ -221,7 +205,22 @@
|
||||
});
|
||||
};
|
||||
|
||||
// Register listeners
|
||||
$scope.$on('sgRevertFolder', function(event, folderId) {
|
||||
if (folderId == $scope.currentFolder.id) {
|
||||
$scope.currentFolder.$reset();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
$scope.$on('sgSaveFolder', function(event, folderId) {
|
||||
if (folderId == $scope.currentFolder.id) {
|
||||
$scope.currentFolder.$rename();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
if ($state.current.name == 'mail' && $scope.accounts.length > 0 && $scope.accounts[0].$mailboxes.length > 0) {
|
||||
// Redirect to first mailbox of first account if no mailbox is selected
|
||||
var account = $scope.accounts[0];
|
||||
var mailbox = account.$mailboxes[0];
|
||||
$state.go('mail.account.mailbox', { accountId: account.id, mailboxId: encodeUriFilter(mailbox.path) });
|
||||
|
||||
Reference in New Issue
Block a user