summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view/ui/send_button.js
diff options
context:
space:
mode:
authorPixelated <pixelated@pix-poa-1>2015-12-23 14:45:52 -0200
committerPixelated <pixelated@pix-poa-1>2015-12-23 14:45:52 -0200
commite0e1ee29e1bede2dbee6108c1a923663eecac9fd (patch)
tree76ed57bb9bd4f59d5398fc8fe7fbc741f7692624 /web-ui/app/js/mail_view/ui/send_button.js
parentaf90d1679a02ad58175b8070cbdfb46666a1dcfc (diff)
enable/disable send button when attachment is uploading
Issue #548
Diffstat (limited to 'web-ui/app/js/mail_view/ui/send_button.js')
-rw-r--r--web-ui/app/js/mail_view/ui/send_button.js16
1 files changed, 15 insertions, 1 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 5c1c3506..b16ea055 100644
--- a/web-ui/app/js/mail_view/ui/send_button.js
+++ b/web-ui/app/js/mail_view/ui/send_button.js
@@ -47,7 +47,7 @@ define([
this.updateButton = function () {
if (this.attr.sendingInProgress === false) {
- if (this.atLeastOneInputFieldHasCharacters() || this.atLeastOneInputFieldHasRecipients()) {
+ if (this.attr.uploading === false && (this.atLeastOneInputFieldHasCharacters() || this.atLeastOneInputFieldHasRecipients())) {
this.enableButton();
} else {
this.disableButton();
@@ -65,6 +65,16 @@ define([
this.updateButton();
};
+ this.uploadInProgress = function (ev, data) {
+ this.attr.uploading = true;
+ this.updateButton();
+ };
+
+ this.uploadFinished = function (ev, data) {
+ this.attr.uploading = false;
+ this.updateButton();
+ };
+
this.updateRecipientsForField = function (ev, data) {
this.attr.recipients[data.recipientsName] = data.newRecipients;
this.attr.inputFieldHasCharacters[data.recipientsName] = false;
@@ -89,6 +99,7 @@ define([
this.resetButton = function () {
this.attr.sendingInProgress = false;
+ this.attr.uploading = false;
this.$node.html(viewHelper.i18n('send-button'));
this.enableButton();
};
@@ -104,6 +115,9 @@ define([
this.on(this.$node, 'click', this.updateRecipientsAndSendMail);
+ this.on(document, events.mail.uploadingAttachment, this.uploadInProgress);
+ this.on(document, events.mail.uploadedAttachment, this.uploadFinished);
+
this.on(document, events.dispatchers.rightPane.clear, this.teardown);
this.on(document, events.ui.sendbutton.enable, this.resetButton);
this.on(document, events.mail.send_failed, this.resetButton);