From 940df3e2e12ff862c9e190fdfcd9a0278164a318 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Fri, 19 Feb 2016 14:56:09 -0300 Subject: Close the compose/inline box right after user clicks Send button and show message later when the email is sent or not. The Growl will be yellow if success and red if the email failed to be sent. Issue #609 --- web-ui/app/js/mail_list_actions/ui/compose_trigger.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'web-ui/app/js/mail_list_actions') diff --git a/web-ui/app/js/mail_list_actions/ui/compose_trigger.js b/web-ui/app/js/mail_list_actions/ui/compose_trigger.js index 33430598..ec79cb26 100644 --- a/web-ui/app/js/mail_list_actions/ui/compose_trigger.js +++ b/web-ui/app/js/mail_list_actions/ui/compose_trigger.js @@ -38,9 +38,19 @@ define( this.trigger(document, events.dispatchers.rightPane.openComposeBox); }; + this.showEmailSuccess = function () { + this.trigger(document, events.ui.userAlerts.displayMessage, {message: 'Your message was sent!', class: 'success'}); + }; + + this.showEmailError = function (ev, data) { + this.trigger(document, events.ui.userAlerts.displayMessage, {message: 'Error, message not sent: ' + data.responseJSON.message, class: 'error'}); + }; + this.after('initialize', function () { this.render(); this.on('click', this.enableComposing); + this.on(document, events.mail.sent, this.showEmailSuccess); + this.on(document, events.mail.send_failed, this.showEmailError); }); } } -- cgit v1.2.3