Use simple input field for custom data dir instead of checkbox (email)

This commit is contained in:
Girish Ramakrishnan
2019-09-19 18:00:18 -07:00
parent 6ffa00026e
commit 50d29f8ef0
2 changed files with 17 additions and 15 deletions
+8 -9
View File
@@ -466,17 +466,17 @@
<div class="task-active-overlay" ng-show="app.taskId"></div>
<div class="row">
<div class="col-md-12">
<label class="control-label" for="emailMailboxNameEnabled">Custom Mail FROM</label>
<p>This sets the address from which this app sends email. This app is already configured to send mail using {{app.domain}}'s <a ng-href="/#/email/{{ app.domain }}">Outbound Email</a> settings.</p>
<fieldset>
<form role="form" name="emailForm" ng-submit="email.submit()" autocomplete="off">
<!-- recvmail currently only works with cloudron email -->
<div class="form-group">
<input type="checkbox" id="emailMailboxNameEnabled" ng-model="email.mailboxNameEnabled">
<label class="control-label" for="emailMailboxNameEnabled">Custom Mail FROM</label>
<p>This sets the address from which this app sends email. This app is already configured to send mail using {{app.domain}}'s <a ng-href="/#/email/{{ app.domain }}">Outbound Email</a> settings.</p>
<div class="has-error" ng-show="email.error.mailboxName">{{ email.error.mailboxName }}</div>
<div class="form-group" ng-class="{ 'has-error': emailForm.$dirty && email.error.mailboxName }">
<div ng-show="email.error.mailboxName">{{ email.error.mailboxName }}</div>
<div class="input-group form-inline" ng-class="{ 'has-error': !emailForm.mailboxName.$dirty && email.error.mailboxName }">
<input type="text" class="form-control" ng-required="email.mailboxNameEnabled" name="mailboxName" ng-model="email.mailboxName" ng-disabled="!email.mailboxNameEnabled">
<input type="text" class="form-control" name="mailboxName" placeholder="Leave empty to use platform default" ng-model="email.mailboxName">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" ng-disabled="!email.mailboxNameEnabled">
@@ -487,15 +487,14 @@
<br/>
</div>
<input class="ng-hide" type="submit" ng-disabled="emailForm.$invalid || email.busy"/>
<input class="ng-hide" type="submit" ng-disabled="!emailForm.$dirty || email.busy"/>
</form>
</fieldset>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<button class="btn btn-outline btn-primary pull-right" ng-click="email.submit()" ng-disabled="email.$invalid || email.busy"><i class="fa fa-circle-notch fa-spin" ng-show="email.busy"></i> Save</button>
<button class="btn btn-outline btn-primary pull-right" ng-click="email.submit()" ng-disabled="!emailForm.$dirty || email.busy"><i class="fa fa-circle-notch fa-spin" ng-show="email.busy"></i> Save</button>
</div>
</div>
</div>
+9 -6
View File
@@ -365,17 +365,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.email = {
busy: false,
error: {},
success: false,
mailboxNameEnabled: false,
mailboxName: '',
domain: '',
show: function () {
var app = $scope.app;
$scope.emailForm.$setPristine();
$scope.email.error = {};
$scope.email.mailboxNameEnabled = app.mailboxName && (app.mailboxName.match(/\.app$/) === null);
$scope.email.mailboxName = app.mailboxName || '';
$scope.email.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
},
@@ -384,7 +382,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.email.error = {};
$scope.email.busy = true;
Client.configureApp($scope.app.id, 'mailbox', { mailboxName: $scope.email.mailboxNameEnabled ? $scope.email.mailboxName : null }, function (error) {
Client.configureApp($scope.app.id, 'mailbox', { mailboxName: $scope.email.mailboxName || null }, function (error) {
if (error && error.statusCode === 400) {
$scope.email.busy = false;
$scope.email.error.mailboxName = error.message;
@@ -393,10 +391,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
if (error) return Client.error(error);
$scope.email.success = true;
$scope.emailForm.$setPristine();
$scope.email.busy = false;
refreshApp();
refreshApp(function (error) {
if (error) return;
// when the mailboxName is 'reset', this will fill it up with the default again
$scope.email.mailboxName = $scope.app.mailboxName || '';
});
});
}
};