(feat) show toast when saving and sending messages

This commit is contained in:
Ludovic Marcotte
2015-12-10 13:41:07 -05:00
parent 2657612136
commit 28399b698a
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -29,7 +29,7 @@
ng-disabled="!(editor.message.editable.to.length > 0 || editor.message.editable.cc.length > 0 || editor.message.editable.bcc.length > 0)">
<md-icon>send</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="editor.message.$save()">
<md-button class="sg-icon-button" ng-click="editor.save()">
<md-icon>save</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="editor.cancel()">
@@ -17,6 +17,7 @@
vm.hideCc = true;
vm.hideBcc = true;
vm.cancel = cancel;
vm.save = save;
vm.send = send;
vm.removeAttachment = removeAttachment;
vm.contactFilter = contactFilter;
@@ -111,11 +112,26 @@
$mdDialog.cancel();
}
function save() {
vm.message.$save().then(function(data) {
$mdToast.show(
$mdToast.simple()
.content(l('Your email has been saved'))
.position('top right')
.hideDelay(3000));
});
}
function send() {
if (vm.autosave)
$timeout.cancel(vm.autosave);
vm.message.$send().then(function(data) {
$mdToast.show(
$mdToast.simple()
.content(l('Your email has been sent'))
.position('top right')
.hideDelay(3000));
$mdDialog.hide();
});
}