diff --git a/src/views/email.html b/src/views/email.html index ce79f62a7..8b0ba15af 100644 --- a/src/views/email.html +++ b/src/views/email.html @@ -230,39 +230,6 @@ - - -

@@ -636,12 +603,6 @@ - -
-
- -
-
diff --git a/src/views/email.js b/src/views/email.js index 6f6f0f2d3..e4bbd4e5e 100644 --- a/src/views/email.js +++ b/src/views/email.js @@ -501,47 +501,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio } }; - $scope.testEmail = { - busy: false, - error: {}, - - mailTo: '', - - domain: null, - - clearForm: function () { - $scope.testEmail.mailTo = ''; - }, - - show: function () { - $scope.testEmail.error = {}; - $scope.testEmail.busy = false; - - $scope.testEmail.domain = $scope.domain; - $scope.testEmail.mailTo = $scope.user.email; - - $('#testEmailModal').modal('show'); - }, - - submit: function () { - $scope.testEmail.error = {}; - $scope.testEmail.busy = true; - - Client.sendTestMail($scope.domain.domain, $scope.testEmail.mailTo, function (error) { - $scope.testEmail.busy = false; - - if (error) { - $scope.testEmail.error.generic = error.message; - console.error(error); - $('#inputTestMailTo').focus(); - return; - } - - $('#testEmailModal').modal('hide'); - }); - } - }; - function resetDnsRecords() { $scope.expectedDnsRecordsTypes.forEach(function (record) { var type = record.value; @@ -703,7 +662,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio }); // setup all the dialog focus handling - ['testEmailModal', 'mailboxAddModal', 'mailboxEditModal', 'mailinglistEditModal', 'mailinglistAddModal'].forEach(function (id) { + ['mailboxAddModal', 'mailboxEditModal', 'mailinglistEditModal', 'mailinglistAddModal'].forEach(function (id) { $('#' + id).on('shown.bs.modal', function () { $(this).find('[autofocus]:first').focus(); }); diff --git a/src/views/emails.html b/src/views/emails.html index a4a6d5263..f2d2e69e9 100644 --- a/src/views/emails.html +++ b/src/views/emails.html @@ -1,3 +1,37 @@ + + + +

@@ -35,7 +69,8 @@ - + + diff --git a/src/views/emails.js b/src/views/emails.js index 6da9d8fb6..4f24e7d76 100644 --- a/src/views/emails.js +++ b/src/views/emails.js @@ -8,6 +8,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati $scope.ready = false; $scope.config = Client.getConfig(); + $scope.user = Client.getUserInfo(); $scope.domains = []; $scope.activity = { @@ -34,6 +35,48 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati } }; + + $scope.testEmail = { + busy: false, + error: {}, + + mailTo: '', + + domain: null, + + clearForm: function () { + $scope.testEmail.mailTo = ''; + }, + + show: function (domain) { + $scope.testEmail.error = {}; + $scope.testEmail.busy = false; + + $scope.testEmail.domain = domain; + $scope.testEmail.mailTo = $scope.user.email; + + $('#testEmailModal').modal('show'); + }, + + submit: function () { + $scope.testEmail.error = {}; + $scope.testEmail.busy = true; + + Client.sendTestMail($scope.testEmail.domain.domain, $scope.testEmail.mailTo, function (error) { + $scope.testEmail.busy = false; + + if (error) { + $scope.testEmail.error.generic = error.message; + console.error(error); + $('#inputTestMailTo').focus(); + return; + } + + $('#testEmailModal').modal('hide'); + }); + } + }; + function refreshDomainStatuses() { $scope.domains.forEach(function (domain) { Client.getMailStatusForDomain(domain.domain, function (error, result) { @@ -59,5 +102,12 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati }); }); + // setup all the dialog focus handling + ['testEmailModal'].forEach(function (id) { + $('#' + id).on('shown.bs.modal', function () { + $(this).find('[autofocus]:first').focus(); + }); + }); + $('.modal-backdrop').remove(); }]);