[IMP] Chatter: first message is truncated after 100 characters, other messages after 300 characters; cleaned code about expan management.

bzr revid: tde@openerp.com-20130425104336-3xvdwgwanrutzinp
This commit is contained in:
Thibault Delavallée 2013-04-25 12:43:36 +02:00
parent 85a807a515
commit e0ea2dbdcb
4 changed files with 12 additions and 2 deletions

View File

@ -362,7 +362,12 @@ class mail_message(osv.Model):
has_voted = uid in [user.id for user in message.vote_user_ids]
try:
body_short = html_email_clean(message.body, remove_unwanted=True, use_max_length=True, max_length=50)
if parent_id:
max_length = 300
else:
max_length = 100
body_short = html_email_clean(message.body, remove=False, shorten=True, max_length=max_length)
except Exception:
body_short = '<p><b>Encoding Error : </b><br/>Unable to convert this message (id: %s).</p>' % message.id
_logger.exception(Exception)

View File

@ -108,6 +108,9 @@
text-overflow:ellipsis;
word-wrap: break-word;
}
.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body .oe_mail_cleaned {
display: none;
}
/* a) Indented Messages */

View File

@ -975,8 +975,10 @@ openerp.mail = function (session) {
},
on_expand: function (event) {
event.stopPropagation();
this.$('.oe_msg_body_short:first').toggle();
this.$('.oe_msg_body_long:first').toggle();
return false;
},
/**

View File

@ -255,7 +255,7 @@
</h1>
<div class="oe_msg_body">
<t t-if="widget.body_short">
<div class="oe_msg_body_short"><t t-raw="widget.body_short"/><span class="oe_mail_expand"><a href="#">... read more</a></span></div>
<div class="oe_msg_body_short"><t t-raw="widget.body_short"/></div>
<div class="oe_msg_body_long" style="display: none;"><t t-raw="widget.body"/><span class="oe_mail_reduce"><a href="#">read less</a></span></div>
</t>
<t t-if="! widget.body_short">