diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py
index 95ce7d5619d..8ba3c02b0b3 100644
--- a/addons/mail/__openerp__.py
+++ b/addons/mail/__openerp__.py
@@ -86,6 +86,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/css/mail.css b/addons/mail/static/src/css/mail.css
index 2421b28fbcb..0cefa82dcca 100644
--- a/addons/mail/static/src/css/mail.css
+++ b/addons/mail/static/src/css/mail.css
@@ -247,6 +247,12 @@
clip: rect(5px, 40px, 45px, 0px);
}
+/* Read more/less link */
+.openerp .oe_mail_msg_content .expand,
+.openerp .oe_mail_msg_content .reduce {
+ font-weight: bold;
+}
+
/* ------------------------------ */
/* Styling (should be openerp) */
/* ------------------------------ */
diff --git a/addons/mail/static/src/js/jquery.expander.min.js b/addons/mail/static/src/js/jquery.expander.min.js
new file mode 100644
index 00000000000..a995fa326a6
--- /dev/null
+++ b/addons/mail/static/src/js/jquery.expander.min.js
@@ -0,0 +1,24 @@
+/*!
+ * jQuery Expander Plugin v1.4.3
+ *
+ * Date: Tue Jun 19 11:54:00 2012 EDT
+ * Requires: jQuery v1.3+
+ *
+ * Copyright 2011, Karl Swedberg
+ * Dual licensed under the MIT and GPL licenses (just like jQuery):
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ *
+ *
+ *
+*/
+(function(c){c.expander={version:"1.4.3",defaults:{slicePoint:100,preserveWords:true,widow:4,expandText:"read more",expandPrefix:"… ",expandAfterSummary:false,summaryClass:"summary",detailClass:"details",moreClass:"read-more",lessClass:"read-less",collapseTimer:0,expandEffect:"slideDown",expandSpeed:250,collapseEffect:"slideUp",collapseSpeed:200,userCollapse:true,userCollapseText:"read less",userCollapsePrefix:" ",onSlice:null,beforeExpand:null,afterExpand:null,onCollapse:null}};c.fn.expander=
+function(l){function J(a,d){var g="span",h=a.summary;if(d){g="div";if(x.test(h)&&!a.expandAfterSummary)h=h.replace(x,a.moreLabel+"$1");else h+=a.moreLabel;h='
'+h+"
"}else h+=a.moreLabel;return[h,"<",g+' class="'+a.detailClass+'"',">",a.details,""+g+">"].join("")}function K(a){var d=''+a.expandPrefix;d+=''+a.expandText+"";return d}function y(a,d){if(a.lastIndexOf("<")>a.lastIndexOf(">"))a=a.slice(0,a.lastIndexOf("<"));
+if(d)a=a.replace(L,"");return c.trim(a)}function z(a,d){d.stop(true,true)[a.collapseEffect](a.collapseSpeed,function(){d.prev("span."+a.moreClass).show().length||d.parent().children("div."+a.summaryClass).show().find("span."+a.moreClass).show()})}function M(a,d,g){if(a.collapseTimer)A=setTimeout(function(){z(a,d);c.isFunction(a.onCollapse)&&a.onCollapse.call(g,false)},a.collapseTimer)}var v="init";if(typeof l=="string"){v=l;l={}}var s=c.extend({},c.expander.defaults,l),N=/^<(?:area|br|col|embed|hr|img|input|link|meta|param).*>$/i,
+L=s.wordEnd||/(&(?:[^;]+;)?|[a-zA-Z\u00C0-\u0100]+)$/,B=/<\/?(\w+)[^>]*>/g,C=/<(\w+)[^>]*>/g,D=/<\/(\w+)>/g,x=/(<\/[^>]+>)\s*$/,O=/^<[^>]+>.?/,A;l={init:function(){this.each(function(){var a,d,g,h,m,i,o,w,E=[],t=[],p={},q=this,e=c(this),F=c([]),b=c.extend({},s,e.data("expander")||c.meta&&e.data()||{});i=!!e.find("."+b.detailClass).length;var r=!!e.find("*").filter(function(){return/^block|table|list/.test(c(this).css("display"))}).length,u=(r?"div":"span")+"."+b.detailClass,G="span."+b.moreClass,
+P=b.expandSpeed||0,n=c.trim(e.html());c.trim(e.text());var f=n.slice(0,b.slicePoint);if(!c.data(this,"expanderInit")){c.data(this,"expanderInit",true);c.each(["onSlice","beforeExpand","afterExpand","onCollapse"],function(j,k){p[k]=c.isFunction(b[k])});f=y(f);for(d=f.replace(B,"").length;d")}else m.splice(I,1)});t.reverse();if(i){i=e.find(u).remove().html();f=e.html();n=f+i;a=""}else{i=n.slice(f.length);a=c.trim(i.replace(B,""));if(a===""||a.split(/\s+/).length'+b.userCollapsePrefix+''+
+b.userCollapseText+"");e.find("span."+b.lessClass+" a").unbind("click.expander").bind("click.expander",function(j){j.preventDefault();clearTimeout(A);j=c(this).closest(u);z(b,j);p.onCollapse&&b.onCollapse.call(q,true)})}})},destroy:function(){if(this.data("expander")){this.removeData("expander");this.each(function(){var a=c(this),d=c.meta?c.extend({},s,a.data()):s,g=a.find("."+d.detailClass).contents();a.find("."+d.moreClass).remove();a.find("."+d.summaryClass).remove();a.find("."+d.detailClass).after(g).remove();
+a.find("."+d.lessClass).remove()})}}};l[v]&&l[v].call(this);return this};c.fn.expander.defaults=c.expander.defaults})(jQuery);
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 5633a4bdae0..72facc8f3dd 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -302,17 +302,17 @@ openerp.mail = function(session) {
record.body = this.do_clean_text(record.body);
record.body = this.do_replace_internal_links(record.body);
- // split for see more
- var split = this.do_truncate_string(record.body, this.params.msg_more_limit);
- record.body_head = split[0];
- record.body_tail = split[1];
-
// format date according to the user timezone
record.date = session.web.format_value(record.date, {type:"datetime"});
-
var rendered = session.web.qweb.render('mail.Thread.message', {'record': record, 'thread': this, 'params': this.params, 'display': this.display});
- $( rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first'));
+ $(rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first'));
+ // expand feature
+ this.$element.find('div.oe_mail_msg_body:last').expander({
+ slicePoint: this.params.msg_more_limit,
+ moreClass: 'oe_mail_expand',
+ lesClass: 'oe_mail_reduce',
+ });
},
/**
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index 34445c48f8d..2eb3a390933 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -91,10 +91,7 @@