diff --git a/dashboard/src/views/email.html b/dashboard/src/views/email.html index 58cd49497..576cee548 100644 --- a/dashboard/src/views/email.html +++ b/dashboard/src/views/email.html @@ -23,6 +23,38 @@ + + + diff --git a/dashboard/src/views/email.js b/dashboard/src/views/email.js index 6156b4925..ee26263f8 100644 --- a/dashboard/src/views/email.js +++ b/dashboard/src/views/email.js @@ -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'); }); } },