diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:54:14 -0200 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:54:14 -0200 |
commit | b5d81e81b0145e32ddfcfe62f169b241beea621c (patch) | |
tree | c98cd96416873ff6a8a682344b8fa0e42afb0489 | |
parent | 077e4100160ba58ee2abf91c0572ca1c0962277e (diff) |
Revert "Revert "Issue #549 - Removing the attachment from UI""
This reverts commit c16af6af2fa6798f5c3f9badfb445e87982e9dc3.
-rw-r--r-- | web-ui/app/js/mail_view/ui/attachment_list.js | 21 |
1 files changed, 16 insertions, 5 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 3d57ede5..c8a646af 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -181,18 +181,29 @@ define( this.select('inputFileUpload').click(); }; + this.removeAttachmentFromList = function(attachment) { + for (var i = 0; i < this.attr.attachments.length; i++) { + if (this.attr.attachments[i].ident === attachment.ident) { + this.attr.attachments.remove(i); + break; + } + } + }; + + this.destroyAttachmentElement = function(attachment) { + this.$node.find('li[data-ident=' + attachment.ident + ']').remove(); + }; + this.removeAttachments = function(event, data) { var success = function() { + this.removeAttachmentFromList(data); + this.destroyAttachmentElement(data); console.log('Success'); }; - var failure = function() { - console.log('Fail!!!!!'); - }; - monitoredAjax(this, '/attachment/' + data.ident, { type: 'DELETE' - }).done(success.bind(this)).fail(failure.bind(this)); + }).done(success.bind(this)); }; this.after('initialize', function () { |