summaryrefslogtreecommitdiff
path: root/web-ui/app/js
diff options
context:
space:
mode:
authorJefferson Stachelski <jstachel@thoughtworks.com>2015-10-28 17:45:56 -0200
committerJefferson Stachelski <jstachel@thoughtworks.com>2015-10-28 17:45:56 -0200
commit553e6bf24af7ea3379c7ee778129db05204a2e40 (patch)
tree5b4cb95cd30a72e1c6f67ab56858387bcdb76940 /web-ui/app/js
parent2199e5ec5f81ddbfe5eaa0ae17443dc2864783f9 (diff)
Issue #493 - Fixed bug delete recipient by buttona
Fixed bug when try delete recipient by clicking on the 'x' button, that was not deleting the recipient inside the flightjs component
Diffstat (limited to 'web-ui/app/js')
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients.js b/web-ui/app/js/mail_view/ui/recipients/recipients.js
index 3dfd6661..966f4ba8 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipients.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipients.js
@@ -58,7 +58,7 @@ define(
this.attr.iterator = null;
var mailAddr = recipient.getMailAddress();
- var position = recipient.$node.closest('.recipients-area').find('.fixed-recipient').index(recipient.$node);
+ var position = this.getRecipientPosition(recipient);
this.attr.recipients.splice(position, 1);
recipient.destroy();
@@ -67,6 +67,10 @@ define(
this.attr.input.$node.val(mailAddr).focus();
};
+ this.getRecipientPosition = function(recipient) {
+ return recipient.$node.closest('.recipients-area').find('.fixed-recipient').index(recipient.$node);
+ }
+
this.unselectAllRecipients = function() {
this.$node.find('.recipient-value.selected').removeClass('selected');
}
@@ -96,14 +100,13 @@ define(
};
this.deleteRecipient = function (event, recipient) {
- var iter = new Iterator(this.attr.recipients, /*startingIndex=*/-1);
+ this.attr.iterator = null;
+ var position = this.getRecipientPosition(recipient);
- while(iter.hasNext() && iter.next()) {
- if (iter.current().isSelected() && iter.current().address === recipient.address) {
- iter.removeCurrent().destroy();
- break;
- }
- }
+ this.attr.recipients.splice(position, 1);
+ recipient.destroy();
+
+ this.addressesUpdated();
};
this.deleteLastRecipient = function () {