more improvement to chatter

bzr revid: mit@openerp.com-20120608172016-nkay98ce3yq8gc4o
This commit is contained in:
Minh Tran 2012-06-08 19:20:16 +02:00
parent 93590e6a2b
commit a02445bf2d
2 changed files with 20 additions and 11 deletions

View File

@ -95,7 +95,7 @@ openerp.mail = function(session) {
this.params = params;
this.params.parent_id = this.params.parent_id || false;
this.params.thread_level = this.params.thread_level || 0;
this.params.msg_more_limit = this.params.msg_more_limit || 100;
this.params.msg_more_limit = this.params.msg_more_limit || 290;
this.params.limit = this.params.limit || 100;
this.params.offset = this.params.offset || 0;
this.params.records = this.params.records || null;
@ -282,8 +282,8 @@ openerp.mail = function(session) {
).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(' <a href="#" class="reduce">[ ... Show less]</a>');
var node_body_short = this.$element.find('span.oe_mail_msg_body_short:last').append(' <a href="#" class="expand">[ ... Show more]</a>');
var node_body = this.$element.find('span.oe_mail_msg_body:last').append('... <a href="#" class="reduce">Less</a>');
var node_body_short = this.$element.find('span.oe_mail_msg_body_short:last').append('... <a href="#" class="expand">More</a>');
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; });
@ -613,6 +613,7 @@ openerp.mail = function(session) {
start: function () {
this._super.apply(this, arguments);
var self = this;
this.display_current_user();
// add events
this.add_event_handlers();
// load mail.message search view
@ -672,6 +673,14 @@ openerp.mail = function(session) {
});
},
display_current_user: function () {
return this.$element.find('img.oe_mail_msg_image').attr('src', this.thread_get_avatar('res.users', 'avatar', this.session.uid));
},
thread_get_avatar: function(model, field, id) {
return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '');
},
/**
* Initializes the wall and calls fetch_comments
* @param {Number} limit: number of notifications to fetch

View File

@ -72,27 +72,27 @@
<t t-name="NoteDisplay">
<p class="oe_mail_msg">
<t t-if="params.thread_level > 0">
<a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a>
<a href="#" class="intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a>
</t>
<span class="oe_mail_msg_body"><t t-raw="record.body"/></span>
<t t-if="record.tr_body"><span class="oe_mail_msg_body_short"><t t-raw="record.tr_body"/></span></t><br/>
<ul>
<t t-if="display['show_reply']">
<li><a href="#" class="oe_mail_msg_reply oe_mail_oe_intlink">Reply</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
<li><a href="#" class="oe_mail_msg_reply">Reply</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
</t>
<t t-if="display['show_delete']">
<t t-if="thread._is_author(record.user_id[0])">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete oe_mail_oe_intlink">Delete</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete">Delete</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
</t>
</t>
<t t-if="display['show_hide']">
<t t-if="!(thread._is_author(record.user_id[0]))">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide oe_mail_oe_intlink">Hide</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
</t>
</t>
<li>
<span class="oe_fade"><t t-raw="record.date"/>
by <a href="#" class="intlink oe_mail_oe_intlink" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}'><t t-raw="record.user_id[1]"/></a>
by <a href="#" class="intlink" data-res-model='res.users' t-attf-data-res-id='{record.user_id[0]}'><t t-raw="record.user_id[1]"/></a>
</span>
</li>
</ul>
@ -102,7 +102,7 @@
<t t-name="EmailDisplay">
<p class="oe_mail_msg oe_mail_msg_p_email_header">
<t t-if="params.thread_level > 0">
<a href="#" class="intlink oe_mail_oe_intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a>
<a href="#" class="intlink" t-attf-data-res-model='{params.res_model}' t-attf-data-res-id='{params.res_id}'><t t-raw="record.record_name"/></a>
</t>
</p>
<p><span class="oe_mail_oe_bold">From:</span> <t t-esc="record.email_from"/></p>
@ -115,12 +115,12 @@
<ul>
<t t-if="display['show_delete']">
<t t-if="thread._is_author(record.user_id[0])">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete oe_mail_oe_intlink">Delete</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_delete">Delete</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
</t>
</t>
<t t-if="display['show_hide']">
<t t-if="!(thread._is_author(record.user_id[0]))">
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide oe_mail_oe_intlink">Hide</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
<li><a href="#" t-attf-data-id='{record.id}' class="oe_mail_msg_hide">Hide</a><span class="oe_mail_oe_space oe_fade"> · </span></li>
</t>
</t>
<li>