diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index 47e3efdcb17..b85b367398c 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -88,6 +88,7 @@ The main features are: 'static/src/css/mail_group.css', ], 'js': [ + 'static/src/js/jquery.expander.min.js', 'static/src/js/mail.js', ], 'qweb': [ diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index b49181eeaf0..2081f8183b9 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -284,24 +284,14 @@ openerp.mail = function(session) { else { record.mini_url = this.thread_get_avatar('res.users', 'avatar', record.user_id[0]); } // body text manipulation record.body = this.do_clean_text(record.body); - record.tr_body = this.do_truncate_string(record.body, this.params.msg_more_limit); record.body = this.do_replace_internal_links(record.body); - console.log(record.body); - console.log(record.tr_body); - if (record.tr_body) record.tr_body = this.do_replace_internal_links(record.tr_body); + this.$element.find('span.oe_mail_msg_body:last').expander(); // format date according to the user timezone record.date = session.web.format_value(record.date, {type:"datetime"}); // render $(session.web.qweb.render('ThreadMsg', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}) ).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // truncated: hide full-text, show summary, add buttons - if (record.tr_body) { - var node_body = this.$element.find('span.oe_mail_msg_body:last').append(' [ ... Show less]'); - var node_body_short = this.$element.find('span.oe_mail_msg_body_short:last').append(' [ ... Show more]'); - node_body.hide(); - node_body.find('a:last').click(function() { node_body.hide(); node_body_short.show(); return false; }); - node_body_short.find('a:last').click(function() { node_body_short.hide(); node_body.show(); return false; }); - } }, /** @@ -436,11 +426,6 @@ openerp.mail = function(session) { return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || ''); }, - do_truncate_string: function(string, max_length) { - if (string.length <= (max_length * 1.2)) return false; - else return string.slice(0, max_length); - }, - do_clean_text: function (string) { var html = $('
').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /)\\s*>', 'gi'), '<$1$2>'); return html; diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 32f3e5665e0..cc423767b81 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -84,9 +84,7 @@
-
+