[IMP] mail: Chatter widget: timeago is not used anymore for old dates; it just displays the date for message older than 1 week. Also added a tip on the timeago which gives the correct date.

bzr revid: tde@openerp.com-20130130132951-w7h14j1fko5a6b73
This commit is contained in:
Thibault Delavallée 2013-01-30 14:29:51 +01:00
commit 843956a624
2 changed files with 4 additions and 4 deletions

View File

@ -218,7 +218,7 @@ openerp.mail = function (session) {
this.author_id = datasets.author_id || false,
this.attachment_ids = datasets.attachment_ids || [],
this.partner_ids = datasets.partner_ids || [];
this._date = datasets.date;
this.date = datasets.date;
this.format_data();
@ -243,8 +243,8 @@ openerp.mail = function (session) {
/* Convert date, timerelative and avatar in displayable data. */
format_data: function () {
//formating and add some fields for render
if (this._date) {
this.timerelative = $.timeago(this._date+"Z");
if (this.date && new Date().getTime()-Date.parse(this.date).getTime() < 7*24*60*60*1000) {
this.timerelative = $.timeago(this.date+"Z");
}
if (this.type == 'email' && (!this.author_id || !this.author_id[0])) {
this.avatar = ('/mail/static/src/img/email_icon.png');

View File

@ -246,7 +246,7 @@
<a t-if="widget.author_id and widget.options.show_link and widget.author_id[0]" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}"><t t-raw="widget.author_id[2]"/></a>
<span t-if="widget.author_id and (!widget.options.show_link or !widget.author_id[0])"><t t-raw="widget.author_id[2]"/></span>
<span class='oe_subtle'></span>
<span t-att-title="widget.date"><t t-raw="widget.timerelative"/></span>
<span t-att-title="widget.date"><t t-if="widget.timerelative" t-raw="widget.timerelative"/><t t-if="!widget.timerelative" t-raw="widget.date"/></span>
<span t-if="!widget.options.readonly" class='oe_subtle'></span>
<t t-if="!widget.options.readonly" t-call="mail.thread.message.vote"/>
</div>