Show warning with more description when enabling email

Fixes #132
This commit is contained in:
Johannes Zellner
2016-12-12 11:57:55 +01:00
parent 382219a29f
commit 700d815d54
2 changed files with 55 additions and 16 deletions

View File

@@ -265,6 +265,33 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
}
};
$scope.email = {
toggle: function () {
if ($scope.mailConfig.enabled) return $scope.email.disable();
// show warning first
$('#enableEmailModal').modal('show');
},
enable: function () {
$('#enableEmailModal').modal('hide');
Client.setMailConfig({ enabled: true }, function (error) {
if (error) return console.error(error);
$scope.mailConfig.enabled = true;
});
},
disable: function () {
Client.setMailConfig({ enabled: false }, function (error) {
if (error) return console.error(error);
$scope.mailConfig.enabled = false;
});
}
};
$scope.configureBackup = {
busy: false,
error: {},
@@ -396,14 +423,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
$scope.toggleEmail = function () {
Client.setMailConfig({ enabled: !$scope.mailConfig.enabled }, function (error) {
if (error) return console.error(error);
$scope.mailConfig.enabled = !$scope.mailConfig.enabled;
});
};
function getPlans() {
AppStore.getSizes(function (error, result) {
if (error) return console.error(error);