diff options
author | NavaL <mnandri@thoughtworks.com> | 2016-01-05 19:44:07 +0100 |
---|---|---|
committer | NavaL <mnandri@thoughtworks.com> | 2016-01-05 19:45:38 +0100 |
commit | 17695c1c9037d9edc927fb5265d380384eb6866a (patch) | |
tree | 44e26d41fec052c9b641d0eba0c92f625680c263 /web-ui/app/js/mail_view/ui | |
parent | 0ca01a8a8e2cd9201f43fa840a30a0822215bfef (diff) |
emptying attachment list when email sent -- in case the user stays on the same screen and re-click compose
Issue #548
Diffstat (limited to 'web-ui/app/js/mail_view/ui')
-rw-r--r-- | web-ui/app/js/mail_view/ui/attachment_list.js | 14 |
1 files changed, 10 insertions, 4 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 36899056..60e6abad 100644 --- a/web-ui/app/js/mail_view/ui/attachment_list.js +++ b/web-ui/app/js/mail_view/ui/attachment_list.js @@ -32,14 +32,15 @@ define( attachmentBaseUrl: '/attachment' }); - this.addAttachment = function (event, data) { + this.showAttachment = function (event, data) { this.trigger(document, events.mail.appendAttachment, data); this.renderAttachmentListView(data); }; this.renderAttachmentListView = function (data) { + var currentHtml = this.select('attachmentListItem').html(); var item = this.buildAttachmentListItem(data); - this.select('attachmentListItem').html(item); + this.select('attachmentListItem').html(currentHtml + '<li>' + item + '</li>'); }; function humanReadable(bytes) { @@ -73,13 +74,18 @@ define( } this.startUpload = function () { - addJqueryFileUploadConfig(this); this.select('inputFileUpload').click(); }; + this.resetAll = function () { + this.teardown(); + }; + this.after('initialize', function () { - this.on(document, events.mail.uploadedAttachment, this.addAttachment); + addJqueryFileUploadConfig(this); + this.on(document, events.mail.uploadedAttachment, this.showAttachment); this.on(document, events.mail.startUploadAttachment, this.startUpload); + this.on(document, events.mail.sent, this.resetAll); }); } |