summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app/js/mail_view')
-rw-r--r--web-ui/app/js/mail_view/data/attachment_list.js11
-rw-r--r--web-ui/app/js/mail_view/ui/attachment_list.js14
2 files changed, 21 insertions, 4 deletions
diff --git a/web-ui/app/js/mail_view/data/attachment_list.js b/web-ui/app/js/mail_view/data/attachment_list.js
index 9193e37a..d1d07e0c 100644
--- a/web-ui/app/js/mail_view/data/attachment_list.js
+++ b/web-ui/app/js/mail_view/data/attachment_list.js
@@ -32,8 +32,19 @@ define(
this.attr.attachments.push(data);
};
+ this.resetAttachmentList = function () {
+ this.attr.attachments = [];
+ };
+
+ this.resetAll = function () {
+ this.resetAttachmentList();
+ this.teardown();
+ };
+
this.after('initialize', function () {
this.on(document, events.mail.appendAttachment, this.addAttachment);
+ this.on(document, events.mail.resetAttachments, this.resetAttachmentList);
+ this.on(document, events.mail.sent, this.resetAll);
});
}
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);
});
}