diff options
author | Jefferson Stachelski <jstachel@thoughtworks.com> | 2016-02-01 17:50:06 -0200 |
---|---|---|
committer | Jefferson Stachelski <jstachel@thoughtworks.com> | 2016-02-01 17:50:47 -0200 |
commit | e3939d4c1dff0f152fa13ce8a89f751c79ecace2 (patch) | |
tree | 67bfc6d9024a271ece8b306101304a01f1f96962 /web-ui/app/js/mail_view/ui/attachment_list.js | |
parent | c7c8607665de3fbe7238436c6b6b240673549aec (diff) |
Issue #549 - Implemented UI part of remote attachments
Diffstat (limited to 'web-ui/app/js/mail_view/ui/attachment_list.js')
-rw-r--r-- | web-ui/app/js/mail_view/ui/attachment_list.js | 16 |
1 files changed, 13 insertions, 3 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 f0581c67..3def6870 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -53,15 +53,25 @@ define( this.renderAttachmentListView = function (data) { var currentHtml = this.select('attachmentListItem').html(); var item = this.buildAttachmentListItem(data); - this.select('attachmentListItem').html(currentHtml + item); + this.select('attachmentListItem').append(item); }; this.buildAttachmentListItem = function (attachment) { var attachmentData = {ident: attachment.ident, encoding: attachment.encoding, name: attachment.name, - size: attachment.size}; - return templates.compose.attachmentItem(attachmentData); + size: attachment.size, + removable: true}; + + var element = $(templates.compose.attachmentItem(attachmentData)); + var self = this; + 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}); + event.preventDefault(); + }); + return element; }; this.checkAttachmentSize = function(e, data) { |