summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view/ui/send_button.js
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-03-24 10:47:39 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-03-24 11:36:29 +0100
commita34d504758fff87f6827b0fe23887c08758975e0 (patch)
tree1d29252201904643ca9546b7dad0a0f20e94ce82 /web-ui/app/js/mail_view/ui/send_button.js
parent66963c9f30a29748b00dd9dc8c25e46523ea2b88 (diff)
Smaller refactoring of send button code.
- Issue #189
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.js24
1 files changed, 12 insertions, 12 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 3e8d0a23..c3adacf4 100644
--- a/web-ui/app/js/mail_view/ui/send_button.js
+++ b/web-ui/app/js/mail_view/ui/send_button.js
@@ -37,17 +37,17 @@ 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.attr.sendingInProgress === false) {
- if (this.atLeastOneInputHasMail() || this.atLeastOneFieldHasRecipients()) {
+ if (this.atLeastOneInputFieldHasCharacters() || this.atLeastOneInputFieldHasRecipients()) {
this.enableButton();
} else {
this.disableButton();
@@ -55,19 +55,19 @@ define([
}
};
- 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();
};
@@ -95,11 +95,11 @@ define([
this.after('initialize', function () {
this.attr.recipients = {};
- this.attr.inputHasMail = {};
+ 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);