summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2016-01-27 15:44:17 -0200
committerGiovane <giovaneliberato@gmail.com>2016-01-27 16:06:26 -0200
commitec80088330eff5f44e8cc8eaab04c83c259b9098 (patch)
tree4aa75950bff5fd6efb8b79b4f9484dd1ac0e64c6 /web-ui/app/js/mail_view
parent0881d95faba366946a1942bf03eec2cb18318aaa (diff)
Keep attachments when forwarding a mail #509
- Extract the attachment file box to a partial - Adds logic to show/hide the download arrow icon
Diffstat (limited to 'web-ui/app/js/mail_view')
-rw-r--r--web-ui/app/js/mail_view/ui/attachment_list.js10
-rw-r--r--web-ui/app/js/mail_view/ui/forward_box.js3
-rw-r--r--web-ui/app/js/mail_view/ui/mail_view.js8
3 files changed, 14 insertions, 7 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 65c7ee09..8428f4a3 100644
--- a/web-ui/app/js/mail_view/ui/attachment_list.js
+++ b/web-ui/app/js/mail_view/ui/attachment_list.js
@@ -50,13 +50,15 @@ define(
this.renderAttachmentListView = function (data) {
var currentHtml = this.select('attachmentListItem').html();
var item = this.buildAttachmentListItem(data);
- this.select('attachmentListItem').html(currentHtml + '<li>' + item + '</li>');
+ this.select('attachmentListItem').html(currentHtml + item);
};
this.buildAttachmentListItem = function (attachment) {
- return '<a href="' + this.attr.attachmentBaseUrl + '/' + attachment.ident + '?filename=' +
- attachment.name + '&encoding=' + attachment.encoding + '">' + attachment.name + ' <span class="attachment-size"> (' + viewHelper.formatSize(attachment.size) + ')' +
- '</span></a>';
+ var attachmentData = {ident: attachment.ident,
+ encoding: attachment.encoding,
+ name: attachment.name,
+ size: attachment.size};
+ return templates.compose.attachmentItem(attachmentData);
};
this.addJqueryFileUploadConfig = function() {
diff --git a/web-ui/app/js/mail_view/ui/forward_box.js b/web-ui/app/js/mail_view/ui/forward_box.js
index fe748365..2f848430 100644
--- a/web-ui/app/js/mail_view/ui/forward_box.js
+++ b/web-ui/app/js/mail_view/ui/forward_box.js
@@ -44,7 +44,8 @@ define(
this.renderInlineCompose('forward-box', {
subject: this.attr.subject,
recipients: { to: [], cc: []},
- body: viewHelper.quoteMail(mail)
+ body: viewHelper.quoteMail(mail),
+ attachments: mail.attachments
});
this.on(this.select('subjectDisplay'), 'click', this.showSubjectInput);
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js
index 093f498d..ba4d6e85 100644
--- a/web-ui/app/js/mail_view/ui/mail_view.js
+++ b/web-ui/app/js/mail_view/ui/mail_view.js
@@ -46,11 +46,15 @@ define(
this.displayMail = function (event, data) {
this.attr.mail = data.mail;
- var signed, encrypted;
+ var signed, encrypted, attachments;
data.mail.security_casing = data.mail.security_casing || {};
signed = this.checkSigned(data.mail);
encrypted = this.checkEncrypted(data.mail);
+ attachments = data.mail.attachments.map(function (attachment) {
+ attachment.received = true;
+ return attachment;
+ });
if(data.mail.mailbox === 'sent') {
encrypted = undefined;
@@ -64,7 +68,7 @@ define(
tags: data.mail.tags,
encryptionStatus: encrypted,
signatureStatus: signed,
- attachments: data.mail.attachments
+ attachments: attachments
}));
this.$node.find('.bodyArea').html(viewHelpers.formatMailBody(data.mail));