diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-03-24 09:23:21 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-03-24 09:56:55 +0100 |
commit | 66963c9f30a29748b00dd9dc8c25e46523ea2b88 (patch) | |
tree | 68fecf130fccb88da4f62f802965d009e7e97e56 /web-ui/app/js | |
parent | b7f311b46d878da77e6424acbae38ad2f19e6c9d (diff) |
Send button not auto re-enabled because of synchronous script execution.
- Issue #189
Diffstat (limited to 'web-ui/app/js')
-rw-r--r-- | web-ui/app/js/mail_view/ui/send_button.js | 23 |
1 files changed, 14 insertions, 9 deletions
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 6f5add2a..3e8d0a23 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -46,10 +46,12 @@ define([ }; this.updateButton = function () { - if (this.atLeastOneInputHasMail() || this.atLeastOneFieldHasRecipients()) { - this.enableButton(); - } else { - this.disableButton(); + if (this.attr.sendingInProgress === false) { + if (this.atLeastOneInputHasMail() || this.atLeastOneFieldHasRecipients()) { + this.enableButton(); + } else { + this.disableButton(); + } } }; @@ -80,18 +82,21 @@ define([ this.disableButton(); this.$node.text(viewHelper.i18n('sending-mail')); + this.attr.sendingInProgress = true; + this.trigger(document, events.ui.recipients.doCompleteInput); }; - this.forceEnableButton = function () { - this.enableButton(); + this.resetButton = function () { + this.attr.sendingInProgress = false; this.$node.html(viewHelper.i18n('send-button')); + this.enableButton(); }; this.after('initialize', function () { this.attr.recipients = {}; this.attr.inputHasMail = {}; - this.$node.html(viewHelper.i18n('send-button')); + this.resetButton() this.on(document, events.ui.recipients.inputHasMail, this.inputHasMail); this.on(document, events.ui.recipients.inputHasNoMail, this.inputHasNoMail); @@ -100,8 +105,8 @@ define([ this.on(this.$node, 'click', this.updateRecipientsAndSendMail); 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.on(document, events.ui.sendbutton.enable, this.resetButton); + this.on(document, events.mail.send_failed, this.resetButton); this.disableButton(); }); |