[FIX] mail: chatter: re-re-add the read more / less

The read more / read less in chatter has been removed in the new timeline and
then cleaned timeline introduced at cc6d2aa995.
This feature has been brought back at revision 486aab5098.
However a new cleaning removed the feature at revision 2a5f07e0b9.

This commit brings back this feature for the second time. Next one brings free
cookies.
This commit is contained in:
Thibault Delavallée
2015-11-18 13:48:27 +01:00
parent e01e24aa9c
commit 2e583eb7c9
5 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ class Message(models.Model):
'attachment_ids': attachment_ids,
'tracking_value_ids': tracking_value_ids,
})
body_short = tools.html_email_clean(message_dict['body'], remove=True)
body_short = tools.html_email_clean(message_dict['body'], shorten=True, remove=True)
message_dict['body_short'] = body_short != message_dict['body'] and body_short or False
return True
@@ -69,6 +69,7 @@ function make_message (data) {
var msg = {
id: data.id,
author_id: data.author_id,
body_short: data.body_short || "",
body: data.body || "",
date: data.date,
message_type: data.message_type,
+6
View File
@@ -35,6 +35,12 @@ var Thread = Widget.extend({
this.$('.o_thread_message').removeClass('o_thread_selected_message');
$(event.currentTarget).toggleClass('o_thread_selected_message', !selected);
},
"click span.oe_mail_expand": function (event) {
event.preventDefault();
var $source = $(event.currentTarget);
$source.parents('.o_thread_message_core').find('.o_mail_body_short').toggle();
$source.parents('.o_thread_message_core').find('.o_mail_body_long').toggle();
},
},
init: function (parent, options) {
+4
View File
@@ -113,6 +113,10 @@
}
}
.o_mail_body_long {
display: none;
}
.o_mail_info {
margin-bottom: 2px;
.text-muted();
+12 -1
View File
@@ -109,7 +109,18 @@
</t>
<p t-if="message.subject" class="o_mail_subject">Subject: <t t-esc="message.subject"/></p>
<t t-if="!(message.tracking_value_ids &amp;&amp; message.tracking_value_ids.length &gt; 0)">
<t t-raw="message.body"/>
<t t-if="message.body_short">
<div class="o_mail_body_short">
<t t-raw="message.body_short"/>
</div>
<div class="o_mail_body_long">
<t t-raw="message.body"/>
<span class="oe_mail_expand"><a href="#">... read less</a></span>
</div>
</t>
<t t-if="! message.body_short">
<t t-raw="message.body"/>
</t>
</t>
<t t-foreach="message.attachment_ids" t-as="attachment">
<t t-call="mail.Attachment"/>