diff options
Diffstat (limited to 'web-ui/app/js/mail_view/ui')
-rw-r--r-- | web-ui/app/js/mail_view/ui/mail_view.js | 2 | ||||
-rw-r--r-- | web-ui/app/js/mail_view/ui/recipients/recipients_input.js | 2 | ||||
-rw-r--r-- | web-ui/app/js/mail_view/ui/send_button.js | 47 |
3 files changed, 28 insertions, 23 deletions
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js index 4faba468..578dcbb9 100644 --- a/web-ui/app/js/mail_view/ui/mail_view.js +++ b/web-ui/app/js/mail_view/ui/mail_view.js @@ -108,7 +108,7 @@ define( var status = ['encrypted']; if(_.any(mail.security_casing.locks, function (lock) { return lock.state === 'valid'; })) { status.push('encryption-valid'); } - else { status.push('encryption-failure'); } + else { status.push('encryption-error'); } return status.join(' '); }; diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js index 459c8b24..012d7fb9 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js @@ -136,7 +136,7 @@ define([ }; this.warnSendButtonOfInputState = function () { - var toTrigger = _.isEmpty(this.$node.val()) ? events.ui.recipients.inputHasNoMail : events.ui.recipients.inputHasMail; + var toTrigger = _.isEmpty(this.$node.val()) ? events.ui.recipients.inputFieldIsEmpty : events.ui.recipients.inputFieldHasCharacters; this.trigger(document, toTrigger, { name: this.attr.name }); }; 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 8f168ecc..5c1c3506 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -37,35 +37,37 @@ define([ this.$node.prop('disabled', true); }; - this.atLeastOneFieldHasRecipients = function () { + this.atLeastOneInputFieldHasRecipients = function () { return _.any(_.values(this.attr.recipients), function (e) { return !_.isEmpty(e); }); }; - this.atLeastOneInputHasMail = function () { - return _.any(_.values(this.attr.inputHasMail), function (e) { return e === true; }); + this.atLeastOneInputFieldHasCharacters = function () { + return _.any(_.values(this.attr.inputFieldHasCharacters), function (e) { return e === true; }); }; this.updateButton = function () { - if (this.atLeastOneInputHasMail() || this.atLeastOneFieldHasRecipients()) { - this.enableButton(); - } else { - this.disableButton(); + if (this.attr.sendingInProgress === false) { + if (this.atLeastOneInputFieldHasCharacters() || this.atLeastOneInputFieldHasRecipients()) { + this.enableButton(); + } else { + this.disableButton(); + } } }; - this.inputHasNoMail = function (ev, data) { - this.attr.inputHasMail[data.name] = false; + this.inputFieldIsEmpty = function (ev, data) { + this.attr.inputFieldHasCharacters[data.name] = false; this.updateButton(); }; - this.inputHasMail = function (ev, data) { - this.attr.inputHasMail[data.name] = true; + this.inputFieldHasCharacters = function (ev, data) { + this.attr.inputFieldHasCharacters[data.name] = true; this.updateButton(); }; this.updateRecipientsForField = function (ev, data) { this.attr.recipients[data.recipientsName] = data.newRecipients; - this.attr.inputHasMail[data.recipientsName] = false; + this.attr.inputFieldHasCharacters[data.recipientsName] = false; this.updateButton(); }; @@ -77,31 +79,34 @@ define([ this.off(document, events.ui.mail.recipientsUpdated); }.bind(this))); - this.trigger(document, events.ui.recipients.doCompleteInput); 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.attr.inputFieldHasCharacters = {}; + this.resetButton(); - this.on(document, events.ui.recipients.inputHasMail, this.inputHasMail); - this.on(document, events.ui.recipients.inputHasNoMail, this.inputHasNoMail); + this.on(document, events.ui.recipients.inputFieldHasCharacters, this.inputFieldHasCharacters); + this.on(document, events.ui.recipients.inputFieldIsEmpty, this.inputFieldIsEmpty); this.on(document, events.ui.recipients.updated, this.updateRecipientsForField); 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(); }); |