From 8e1eb820f1392cd105af26f633f263b631d0e855 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 4 Dec 2012 17:43:30 +0100 Subject: [PATCH] Changed dates bzr revid: nicolas.vanhoren@openerp.com-20121204164330-1h2dr0wcc2txouo3 --- addons/web_im/static/src/css/im.css | 9 ++++++++- addons/web_im/static/src/js/im.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/web_im/static/src/css/im.css b/addons/web_im/static/src/css/im.css index b5053a9f757..5955aa414c9 100644 --- a/addons/web_im/static/src/css/im.css +++ b/addons/web_im/static/src/css/im.css @@ -190,6 +190,7 @@ } .openerp .oe_im_chatview .oe_im_chatview_bubble { background: white; + position: relative; padding: 3px; margin: 3px; -moz-border-radius: 3px; @@ -219,17 +220,23 @@ -ms-interpolation-mode: bicubic; } .openerp .oe_im_chatview .oe_im_chatview_time { + position: absolute; + right: 0px; + top: 0px; + margin: 3px; text-align: right; line-height: 13px; font-size: 11px; color: #999; + width: 60px; + overflow: hidden; } .openerp .oe_im_chatview .oe_im_chatview_from { margin: 0 0 2px 0; line-height: 14px; font-weight: bold; font-size: 12px; - width: 154px; + width: 140px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; diff --git a/addons/web_im/static/src/js/im.js b/addons/web_im/static/src/js/im.js index 49fa9012f31..d68edd7aeaf 100644 --- a/addons/web_im/static/src/js/im.js +++ b/addons/web_im/static/src/js/im.js @@ -367,7 +367,14 @@ openerp.web_im = function(instance) { this.last_user = user; this.last_items = items; date = instance.web.str_to_datetime(date); - date = date.toString(Date.CultureInfo.formatPatterns.shortDate + " " + Date.CultureInfo.formatPatterns.shortTime); + var now = new Date(); + var diff = now - date; + if (diff > (1000 * 60 * 60 * 24)) { + date = $.timeago(date); + } else { + date = date.toString(Date.CultureInfo.formatPatterns.shortTime); + } + this.last_bubble = $(QWeb.render("Conversation.bubble", {"items": items, "user": user, "time": date})); $(this.$(".oe_im_chatview_content").children()[0]).append(this.last_bubble); this._go_bottom();