[FIX] mail: display attachment preview

This commit is contained in:
Christophe Matthieu
2015-09-11 11:07:07 +02:00
parent 614b40b304
commit a4f041ed45
2 changed files with 16 additions and 0 deletions
@@ -391,6 +391,14 @@ var ChatterMailThread = form_common.AbstractField.extend(mail_thread.MailThreadM
*/
message_render: function(){
this.$('.o_mail_chatter_messages').html(QWeb.render('mail.chatter.ChatterMailThread.messages', {'widget': this}));
// display image thumbnail
this.$(".o_mail_chatter_messages .o_image[data-mimetype^='image']").each(function () {
var $img = $(this);
if (/gif|jpe|jpg|png/.test($img.data('mimetype')) && $img.data('src')) {
$img.css('background-image', "url('" + $img.data('src') + "')");
}
});
},
/**
* Order the messages
+8
View File
@@ -281,6 +281,14 @@ var MailComposeMessage = Widget.extend({
},
attachment_render: function(){
this.$attachments_list.html(QWeb.render('mail.ComposeMessage.attachments', {'widget': this}));
// display image thumbnail
this.$attachments_list.find(".o_image[data-mimetype^='image']").each(function () {
var $img = $(this);
if (/gif|jpe|jpg|png/.test($img.data('mimetype')) && $img.data('src')) {
$img.css('background-image', "url('" + $img.data('src') + "')");
}
});
},
// Mention
on_click_mention_item: function(event){