summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorLisa Junger <ljunger@thoughtworks.com>2014-12-08 16:23:25 +0100
committerLisa Junger <ljunger@thoughtworks.com>2014-12-09 15:47:55 +0100
commitbe5540272d6e39c49fbcad87945211462dcc780d (patch)
treee22bc1daa5dceeb5f16b32fe7c5d788a49242f3d /web-ui
parent695b5a035be7c5ceeba289f1613b5e0e5b6d2aba (diff)
issue #172 adopted behavior of send button to monitored ajax calls.
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/mail_view/data/mail_sender.js3
-rw-r--r--web-ui/app/js/mail_view/ui/send_button.js6
-rw-r--r--web-ui/app/js/page/events.js1
3 files changed, 9 insertions, 1 deletions
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 f769c262..a5a28209 100644
--- a/web-ui/app/js/mail_view/data/mail_sender.js
+++ b/web-ui/app/js/mail_view/data/mail_sender.js
@@ -48,11 +48,12 @@ define(
contextMessage = context + ': ';
}
- if (xhr.responseJSON.message) {
+ if (xhr && xhr.responseJSON && xhr.responseJSON.message) {
on.trigger(document, events.ui.userAlerts.displayMessage, {message: contextMessage + xhr.responseJSON.message});
} else {
on.trigger(document, events.ui.userAlerts.displayMessage, {message: 'Ops! something went wrong, try again later.'});
}
+ on.trigger(document, events.mail.send_failed, {xhr: xhr, error:error});
};
}
diff --git a/web-ui/app/js/mail_view/ui/send_button.js b/web-ui/app/js/mail_view/ui/send_button.js
index 5454ab0a..442f1c00 100644
--- a/web-ui/app/js/mail_view/ui/send_button.js
+++ b/web-ui/app/js/mail_view/ui/send_button.js
@@ -84,6 +84,11 @@ define([
};
+ this.forceEnableButton = function () {
+ this.enableButton();
+ this.$node.html(viewHelper.i18n('send-button'));
+ }
+
this.after('initialize', function () {
this.attr.recipients = {};
this.attr.inputHasMail = {};
@@ -97,6 +102,7 @@ define([
this.on(document, events.dispatchers.rightPane.clear, this.teardown);
this.on(document, events.ui.sendbutton.enable, this.enableButton);
+ this.on(document, events.mail.send_failed, this.forceEnableButton);
this.disableButton();
});
diff --git a/web-ui/app/js/page/events.js b/web-ui/app/js/page/events.js
index 76a6b7fa..ff9ed10a 100644
--- a/web-ui/app/js/page/events.js
+++ b/web-ui/app/js/page/events.js
@@ -101,6 +101,7 @@ define(function () {
here: 'mail:here',
want: 'mail:want',
send: 'mail:send',
+ send_failed: 'mail:send_failed',
sent: 'mail:sent',
read: 'mail:read',
unread: 'mail:unread',