diff options
author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2016-02-17 17:00:52 -0200 |
---|---|---|
committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2016-02-17 17:24:18 -0200 |
commit | 24cea641287831a1ea32574e3b62ba858b89f0de (patch) | |
tree | 8e58a8dfc47d0d969daef5310b8444cfef77afee /web-ui/app/js/mail_view/ui | |
parent | f317af2aac852f760830f31b494c2e125668e00e (diff) |
Fixed bug removing duplicated attachment
Issue #549
Diffstat (limited to 'web-ui/app/js/mail_view/ui')
-rw-r--r-- | web-ui/app/js/mail_view/ui/attachment_list.js | 14 | ||||
-rw-r--r-- | web-ui/app/js/mail_view/ui/draft_box.js | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/web-ui/app/js/mail_view/ui/attachment_list.js b/web-ui/app/js/mail_view/ui/attachment_list.js index 0483ae6a..ef2960f7 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -71,7 +71,7 @@ define( element.find('i.remove-icon').bind('click', function(event) { var element = $(this); var ident = element.closest('li').attr('data-ident'); - self.trigger(document, events.mail.removeAttachment, {ident: ident}); + self.trigger(document, events.mail.removeAttachment, {ident: ident, element: element}); event.preventDefault(); }); return element; @@ -181,22 +181,22 @@ define( this.select('inputFileUpload').click(); }; - this.removeAttachmentFromList = function(attachment) { + this.removeAttachmentFromList = function(ident) { for (var i = 0; i < this.attr.attachments.length; i++) { - if (this.attr.attachments[i].ident === attachment.ident) { + if (this.attr.attachments[i].ident === ident) { this.attr.attachments.remove(i); break; } } }; - this.destroyAttachmentElement = function(attachment) { - this.$node.find('li[data-ident=' + attachment.ident + ']').remove(); + this.destroyAttachmentElement = function(element) { + element.closest('li').remove(); }; this.removeAttachments = function(event, data) { - this.removeAttachmentFromList(data); - this.destroyAttachmentElement(data); + this.removeAttachmentFromList(data.ident); + this.destroyAttachmentElement(data.element); }; this.after('initialize', function () { diff --git a/web-ui/app/js/mail_view/ui/draft_box.js b/web-ui/app/js/mail_view/ui/draft_box.js index 07a7e472..afe31914 100644 --- a/web-ui/app/js/mail_view/ui/draft_box.js +++ b/web-ui/app/js/mail_view/ui/draft_box.js @@ -71,7 +71,7 @@ define( this.$node.find('i.remove-icon').bind('click', function(event) { var element = $(this); var ident = element.closest('li').attr('data-ident'); - self.trigger(document, events.mail.removeAttachment, {ident: ident}); + self.trigger(document, events.mail.removeAttachment, {ident: ident, element: element}); event.preventDefault(); }); |