summaryrefslogtreecommitdiff
path: root/web-ui/app/js
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app/js')
-rw-r--r--web-ui/app/js/mail_list_actions/ui/compose_trigger.js10
-rw-r--r--web-ui/app/js/mail_view/data/mail_sender.js3
-rw-r--r--web-ui/app/js/user_alerts/ui/user_alerts.js2
3 files changed, 13 insertions, 2 deletions
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);
});
}
}
diff --git a/web-ui/app/js/mail_view/data/mail_sender.js b/web-ui/app/js/mail_view/data/mail_sender.js
index 0d11c636..8bb01f70 100644
--- a/web-ui/app/js/mail_view/data/mail_sender.js
+++ b/web-ui/app/js/mail_view/data/mail_sender.js
@@ -36,7 +36,7 @@ define(
function failureSendingMail(on) {
return function(result) {
- on.trigger(document, events.mail.send_failed);
+ on.trigger(document, events.mail.send_failed, result);
};
}
@@ -51,6 +51,7 @@ define(
});
this.sendMail = function(event, data) {
+ this.trigger(events.dispatchers.rightPane.openNoMessageSelected);
monitoredAjax.call(_, this, this.attr.mailsResource, {
type: 'POST',
dataType: 'json',
diff --git a/web-ui/app/js/user_alerts/ui/user_alerts.js b/web-ui/app/js/user_alerts/ui/user_alerts.js
index 57701579..b02762aa 100644
--- a/web-ui/app/js/user_alerts/ui/user_alerts.js
+++ b/web-ui/app/js/user_alerts/ui/user_alerts.js
@@ -40,7 +40,7 @@ define(
this.displayMessage = function (ev, data) {
- this.render({ message: data.message});
+ this.render({ message: {content: data.message, class: (data.class || 'success')}});
};
this.after('initialize', function () {