summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/mail.js
diff options
context:
space:
mode:
authorDivyesh Makwana (Open ERP) <mdi@tinyerp.com>2012-07-03 14:28:16 +0530
committerDivyesh Makwana (Open ERP) <mdi@tinyerp.com>2012-07-03 14:28:16 +0530
commitf28cfcfe8a16e77acd7e390e25fff2793e4e6548 (patch)
treefe3fad1ad3f95ff11a34638ea5c7f325cecfa25c /addons/mail/static/src/js/mail.js
parent9ce0d57fbe8357e00e72123e7e4c07326b26b261 (diff)
parent1e123ce0c86060be9ad66fa8962912b14597c699 (diff)
[Merge] Merge with main addons.
bzr revid: mdi@tinyerp.com-20120703043709-c8o4k6hjfw5v8gn0 bzr revid: mdi@tinyerp.com-20120703085816-mc75d3ukecz03m79
Diffstat (limited to 'addons/mail/static/src/js/mail.js')
-rw-r--r--addons/mail/static/src/js/mail.js33
1 files changed, 11 insertions, 22 deletions
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 5633a4bdae0..da54130d093 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('&lt;(/)?(b|em|br|br /)\\s*&gt;', 'gi'), '<$1$2>');
@@ -565,7 +554,7 @@ openerp.mail = function(session) {
},
fetch_subscribers: function () {
- return this.ds.call('message_get_subscribers', [[this.view.datarecord.id]]).then(this.proxy('display_subscribers'));
+ return this.ds.call('message_read_subscribers', [[this.view.datarecord.id]]).then(this.proxy('display_subscribers'));
},
display_subscribers: function (records) {