Move mailbox add form to dialog

This commit is contained in:
Johannes Zellner
2018-04-09 15:56:20 +02:00
parent 75b597418c
commit 14536febaf
2 changed files with 52 additions and 22 deletions

View File

@@ -192,27 +192,37 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
mailboxes: [],
add: {
error: '',
error: null,
busy: false,
name: '',
owner: null,
reset: function () {
$scope.mailboxes.add.busy = false;
$scope.mailboxes.add.error = null;
$scope.mailboxes.add.name = '';
$scope.mailboxes.add.owner = null;
},
show: function () {
$scope.mailboxes.add.reset();
$('#mailboxAddModal').modal('show');
},
submit: function () {
$scope.mailboxes.add.busy = true;
Client.addMailbox($scope.selectedDomain.domain, $scope.mailboxes.add.name, $scope.mailboxes.add.owner.id, function (error) {
$scope.mailboxes.add.busy = false;
if (error) {
$scope.mailboxes.add.busy = false;
$scope.mailboxes.add.error = error.message;
return;
}
$scope.mailboxes.add.error = '';
$scope.mailboxes.add.name = '';
$scope.mailboxes.add.owner = null;
$scope.mailboxes.add.reset();
$scope.mailboxes.refresh();
$('#mailboxAddModal').modal('hide');
});
}
},