diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:53:41 -0200 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-02-12 14:53:41 -0200 |
commit | 077e4100160ba58ee2abf91c0572ca1c0962277e (patch) | |
tree | 336ba2bc1484d423f5f807247f13482915c91140 /web-ui/app/js/mail_view/ui/attachment_list.js | |
parent | 78925e0332bbc41ed37e27d506be192abdb7124e (diff) |
Revert "Revert "Issue #549 - Implemented remove attachment""
This reverts commit 3c6b905d7e5b78e521b2e7692e5e32b7b0c226bc.
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 | 20 |
1 files changed, 18 insertions, 2 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 b3b26710..3d57ede5 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -19,10 +19,11 @@ define( [ 'views/templates', 'page/events', - 'helpers/view_helper' + 'helpers/view_helper', + 'helpers/monitored_ajax' ], - function (templates, events, viewHelper) { + function (templates, events, viewHelper, monitoredAjax) { 'use strict'; function attachmentList() { @@ -180,11 +181,26 @@ define( this.select('inputFileUpload').click(); }; + this.removeAttachments = function(event, data) { + var success = function() { + console.log('Success'); + }; + + var failure = function() { + console.log('Fail!!!!!'); + }; + + monitoredAjax(this, '/attachment/' + data.ident, { + type: 'DELETE' + }).done(success.bind(this)).fail(failure.bind(this)); + }; + this.after('initialize', function () { this.addJqueryFileUploadConfig(); this.on(document, events.mail.uploadedAttachment, this.showAttachment); this.on(document, events.mail.startUploadAttachment, this.startUpload); this.on(document, events.mail.appendAttachment, this.addAttachment); + this.on(document, events.mail.removeAttachment, this.removeAttachments); }); } |