diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-04-25 12:43:36 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-04-25 12:43:36 +0200 |
| commit | e0ea2dbdcb7af84f2f3bdab228bb4805ce9a56f9 (patch) | |
| tree | c715b58b2153fa270c74fa900d9d3ca6851b67af /addons | |
| parent | 85a807a5153d357e83a0f01d4940b5c6c2582403 (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mail/mail_message.py | 7 | ||||
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 3 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 2 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 2 |
4 files changed, 12 insertions, 2 deletions
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index ec6a8db526e..746471c3ffa 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -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) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 6bc086a5b58..6bde62bcd4b 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -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 */ diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 5ab6d2380a0..81a800b7357 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -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; }, /** diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 9958cb5e595..dfbabcd1f89 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -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"> |
