Remove mailbox inline editing
This commit is contained in:
@@ -195,16 +195,14 @@
|
||||
{{ mailbox.name }}
|
||||
</td>
|
||||
<td class="text-left elide-table-cell">
|
||||
<select class="form-control" ng-model="mailbox.owner" ng-options="u.display for u in users track by u.id"></select>
|
||||
{{ mailbox.owner.display }}
|
||||
</td>
|
||||
<td class="elide-table-cell no-wrap" style="vertical-align: middle;">
|
||||
<p ng-show="mailbox.aliases !== mailbox.orig.aliases && mailbox.error" class="text-danger"><b>{{ mailbox.error }}</b></p>
|
||||
<tag-input placeholder="add alias" taglist="mailbox.aliases" name="aliases"></tag-input>
|
||||
{{ mailbox.aliases }}
|
||||
</td>
|
||||
<td class="text-right no-wrap">
|
||||
<button ng-show="mailbox.owner !== mailbox.orig.owner || mailbox.aliases !== mailbox.orig.aliases" class="btn btn-success" ng-disabled="mailbox.busy" ng-click="mailboxes.submit(mailbox)"><i class="fa" ng-class="{ 'fa-spin': mailbox.busy, 'fa-circle-o-notch': mailbox.busy, 'fa-check': !mailbox.busy }"></i></button>
|
||||
<button class="btn btn-default" ng-click="mailboxes.edit.show(mailbox)"><i class="fa fa-pencil"></i></button>
|
||||
<button class="btn btn-danger" ng-click="mailboxes.remove.show(mailbox)"><i class="fa fa-trash"></i></button>
|
||||
<button class="btn btn-xs btn-default" ng-click="mailboxes.edit.show(mailbox)"><i class="fa fa-pencil"></i></button>
|
||||
<button class="btn btn-xs btn-danger" ng-click="mailboxes.remove.show(mailbox)"><i class="fa fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -289,39 +289,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
submit: function (mailbox) {
|
||||
mailbox.busy = true;
|
||||
mailbox.error ='';
|
||||
|
||||
var aliases = mailbox.aliases.split(',').map(function (a) { return a.trim(); }).filter(function (a) { return !!a; });
|
||||
|
||||
function done(error) {
|
||||
mailbox.busy = false;
|
||||
|
||||
if (error && error.statusCode === 409) {
|
||||
var alias = error.message.match(RegExp('\'(.*)-' + $scope.selectedDomain.domain + '\''))[1];
|
||||
mailbox.error = alias + '@' + $scope.selectedDomain.domain + ' already exists';
|
||||
return;
|
||||
} else if (error && error.statusCode === 400) {
|
||||
mailbox.error = error.message;
|
||||
return;
|
||||
} else if (error) {
|
||||
console.error('Unable to configure mailbox.', error);
|
||||
return;
|
||||
}
|
||||
|
||||
// reset the dirty state
|
||||
mailbox.orig.aliases = mailbox.aliases;
|
||||
mailbox.orig.owner = mailbox.owner;
|
||||
}
|
||||
|
||||
Client.updateMailbox($scope.selectedDomain.domain, mailbox.name, mailbox.owner.id, function (error) {
|
||||
if (error) return done(error);
|
||||
|
||||
Client.setAliases($scope.selectedDomain.domain, mailbox.name, aliases, done);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user