diff options
| author | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-07-02 18:38:30 +0200 |
|---|---|---|
| committer | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-07-02 18:38:30 +0200 |
| commit | b2a1eeecbe88a2fa764ea73c0b40a9f28f313ab9 (patch) | |
| tree | 006ced07858bd3601783de7494b5cdcaaee8016a /addons/mail/static/src | |
| parent | 89f6e166755884de1fbbd58dbf02e90ea8908180 (diff) | |
| parent | 472fa74b129afb80f4ab47c641de533defbe362a (diff) | |
[MERGE] merged with trunk
bzr revid: qdp-launchpad@openerp.com-20120702163830-bp1ekxuzuf9uox01
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 4 | ||||
| -rw-r--r-- | addons/mail/static/src/css/mail_group.css | 43 | ||||
| -rw-r--r-- | addons/mail/static/src/js/jquery.expander.min.js | 24 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 31 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 5 |
5 files changed, 74 insertions, 33 deletions
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 2421b28fbcb..0cf932f9a25 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -314,8 +314,8 @@ text-align: justify; } -.openerp .oe_mail_msg_tail { - display: none; +.openerp .oe_mail_msg_body span.oe_mail_msg_tail { + display: inline; } /* Read more/less link */ diff --git a/addons/mail/static/src/css/mail_group.css b/addons/mail/static/src/css/mail_group.css index 90261499753..048b7a06415 100644 --- a/addons/mail/static/src/css/mail_group.css +++ b/addons/mail/static/src/css/mail_group.css @@ -1,3 +1,40 @@ +/* ------------------------------ */ +/* Group Form */ +/* ------------------------------ */ + +/* Resize sheet width */ +.openerp .oe_form_sheetbg.openerp_mail_group_sheet { + min-height: 0px; + max-height: none; +} + +.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_sheet { + min-height: 0px; + max-height: none; + padding: 0px 18px; + max-width: 80%; +} + +/* Resize footer width */ +.openerp .oe_form footer.openerp_mail_group_footer { + max-width: 80%; +} + +/* Resize group logo */ +.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_field_image > img { + max-width: 100px; + max-height: 100px; +} + +/* Resize group description */ +.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_field_text > textarea { + height: 40px; +} + +/* ------------------------------ */ +/* Group Kanban */ +/* ------------------------------ */ + .oe_group_vignette { padding: 8px 0; min-height: 100px; @@ -71,9 +108,3 @@ .oe_group_details li { margin: 2px 0; } - -.oe_group_description { -} - -.oe_kanban_record div.true { -} 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..2c61251fcf0 --- /dev/null +++ b/addons/mail/static/src/js/jquery.expander.min.js @@ -0,0 +1,24 @@ +/*! + * jQuery Expander Plugin v1.4.2 + * + * Date: Sat Mar 31 20:51:48 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.2",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='<div class="'+a.summaryClass+'">'+h+"</div>"}else h+=a.moreLabel;return[h,"<",g+' class="'+a.detailClass+'"',">",a.details,"</"+g+">"].join("")}function K(a){var d='<span class="'+a.moreClass+'">'+a.expandPrefix;d+='<a href="#">'+a.expandText+"</a></span>";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 o=c.extend({},c.expander.defaults,l),N=/^<(?:area|br|col|embed|hr|img|input|link|meta|param).*>$/i, +L=o.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,p,w,E=[],t=[],q={},r=this,f=c(this),F=c([]),b=c.meta?c.extend({},o,f.data()):o;i=!!f.find("."+b.detailClass).length;var s=!!f.find("*").filter(function(){return/^block|table|list/.test(c(this).css("display"))}).length,u=(s?"div":"span")+"."+b.detailClass,G="span."+b.moreClass,P=b.expandSpeed||0,n=c.trim(f.html()); +c.trim(f.text());var e=n.slice(0,b.slicePoint);if(!c.data(this,"expander")){c.data(this,"expander",true);c.each(["onSlice","beforeExpand","afterExpand","onCollapse"],function(j,k){q[k]=c.isFunction(b[k])});e=y(e);for(d=e.replace(B,"").length;d<b.slicePoint;){a=n.charAt(e.length);if(a=="<")a=n.slice(e.length).match(O)[0];e+=a;d++}e=y(e,b.preserveWords);h=e.match(C)||[];m=e.match(D)||[];g=[];c.each(h,function(j,k){N.test(k)||g.push(k)});h=g;d=m.length;for(a=0;a<d;a++)m[a]=m[a].replace(D,"$1");c.each(h, +function(j,k){var H=k.replace(C,"$1"),I=c.inArray(H,m);if(I===-1){E.push(k);t.push("</"+H+">")}else m.splice(I,1)});t.reverse();if(i){i=f.find(u).remove().html();e=f.html();n=e+i;a=""}else{i=n.slice(e.length);a=c.trim(i.replace(B,""));if(a===""||a.split(/\s+/).length<b.widow)return;a=t.pop()||"";e+=t.join("");i=E.join("")+i}b.moreLabel=f.find(G).length?"":K(b);if(s)i=n;e+=a;b.summary=e;b.details=i;b.lastCloseTag=a;if(q.onSlice)b=(g=b.onSlice.call(r,b))&&g.details?g:b;s=J(b,s);f.html(s);p=f.find(u); +w=f.find(G);p.hide();w.find("a").unbind("click.expander").bind("click.expander",function(j){j.preventDefault();w.hide();F.hide();q.beforeExpand&&b.beforeExpand.call(r);p.stop(false,true)[b.expandEffect](P,function(){p.css({zoom:""});q.afterExpand&&b.afterExpand.call(r);M(b,p,r)})});F=f.find("div."+b.summaryClass);b.userCollapse&&!f.find("span."+b.lessClass).length&&f.find(u).append('<span class="'+b.lessClass+'">'+b.userCollapsePrefix+'<a href="#">'+b.userCollapseText+"</a></span>");f.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);q.onCollapse&&b.onCollapse.call(r,true)})}})},destroy:function(){if(this.data("expander")){this.removeData("expander");this.each(function(){var a=c(this),d=c.meta?c.extend({},o,a.data()):o,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..e724a8bcbd0 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -302,17 +302,20 @@ 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, + expandText: 'see more', + userCollapseText: 'see less', + detailClass: 'oe_mail_msg_tail', + moreClass: 'oe_mail_expand', + lesClass: 'oe_mail_reduce', + }); }, /** @@ -447,20 +450,6 @@ openerp.mail = function(session) { return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || ''); }, - /** - * @param {String} string to truncate - * @param {Number} max number of chars to display - * @returns {String} truncated string - */ - do_truncate_string: function(string, max_length) { - // multiply by 1.2: prevent truncating an just too little long string - if (string.length <= (max_length * 1.2)) { - return [string, ""]; - } else { - return [string.slice(0, max_length), string.slice(max_length)]; - } - }, - /** Removes html tags, except b, em, br */ do_clean_text: function (string) { var html = $('<div/>').text(string.replace(/\s+/g, ' ')).html().replace(new RegExp('<(/)?(b|em|br|br /)\\s*>', 'gi'), '<$1$2>'); 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 @@ </div> <div class="oe_mail_msg_body"> <a href="#" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}' class="oe_mail_internal_link"><t t-raw="record.user_id[1]"/></a> - <t t-raw="record.body_head"/> - <t t-if="record.body_tail"><a href="#" class="oe_mail_msg_more">... See more</a> - <span class="oe_mail_msg_tail"><t t-raw="record.body_tail"/></span> - </t> + <t t-raw="record.body"/> </div> <ul class="oe_mail_msg_footer"> <li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li> |
