summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome.js
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2012-12-10 13:54:23 +0100
committerThibault Delavallée <tde@openerp.com>2012-12-10 13:54:23 +0100
commit1ca5e68b1f3ddb440b104c6c47ea35e8d26a1eed (patch)
tree4070b56d1253290fa69f4fbc43ad4862c883080e /addons/web/static/src/js/chrome.js
parenta5ca416f055871fb2765567c2cf2f06445c1d2ca (diff)
parent70f8f99b35c93a880cf15a1f21b7f88aef5a8d36 (diff)
[MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121130093732-i8y10ayjqiaq5t7p bzr revid: tde@openerp.com-20121204142854-pauouyapnw7z8zwj bzr revid: tde@openerp.com-20121205101544-k4ui6thr0ibzw0vx bzr revid: tde@openerp.com-20121210125423-81wbh4af9sxdqjki
Diffstat (limited to 'addons/web/static/src/js/chrome.js')
-rw-r--r--addons/web/static/src/js/chrome.js49
1 files changed, 27 insertions, 22 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index c6d216d128c..55e14d6d783 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -830,7 +830,7 @@ instance.web.Menu = instance.web.Widget.extend({
this.renderElement();
this.limit_entries();
// Hide toplevel item if there is only one
- var $toplevel = this.$("li")
+ var $toplevel = this.$("li");
if($toplevel.length == 1) {
$toplevel.hide();
}
@@ -1125,7 +1125,6 @@ instance.web.WebClient = instance.web.Client.extend({
start: function() {
var self = this;
return $.when(this._super()).then(function() {
- self.$(".oe_logo").attr("href", $.param.fragment("" + window.location, "", 2).slice(0, -1));
if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
$("body").addClass("kitten-mode-activated");
if ($.blockUI) {
@@ -1186,26 +1185,32 @@ instance.web.WebClient = instance.web.Client.extend({
},
check_timezone: function() {
var self = this;
- var user_offset = instance.session.user_context.tz_offset;
- var offset = -(new Date().getTimezoneOffset());
- // _.str.sprintf()'s zero front padding is buggy with signed decimals, so doing it manually
- var browser_offset = (offset < 0) ? "-" : "+";
- browser_offset += _.str.sprintf("%02d", Math.abs(offset / 60));
- browser_offset += _.str.sprintf("%02d", Math.abs(offset % 60));
- if (browser_offset !== user_offset) {
- var notification = this.do_warn(_t("Timezone"), QWeb.render('WebClient.timezone_notification', {
- user_timezone: instance.session.user_context.tz || 'UTC',
- user_offset: user_offset,
- browser_offset: browser_offset,
- }), true);
- notification.element.find('.oe_webclient_timezone_notification').on('click', function() {
- notification.close();
- }).find('a').on('click', function() {
- notification.close();
- self.user_menu.on_menu_settings();
- return false;
- });
- }
+ return new instance.web.Model('res.users').call('read', [[this.session.uid], ['tz_offset']]).then(function(result) {
+ var user_offset = result[0]['tz_offset'];
+ var offset = -(new Date().getTimezoneOffset());
+ // _.str.sprintf()'s zero front padding is buggy with signed decimals, so doing it manually
+ var browser_offset = (offset < 0) ? "-" : "+";
+ browser_offset += _.str.sprintf("%02d", Math.abs(offset / 60));
+ browser_offset += _.str.sprintf("%02d", Math.abs(offset % 60));
+ if (browser_offset !== user_offset) {
+ var $icon = $(QWeb.render('WebClient.timezone_systray'));
+ $icon.on('click', function() {
+ var notification = self.do_warn(_t("Timezone mismatch"), QWeb.render('WebClient.timezone_notification', {
+ user_timezone: instance.session.user_context.tz || 'UTC',
+ user_offset: user_offset,
+ browser_offset: browser_offset,
+ }), true);
+ notification.element.find('.oe_webclient_timezone_notification').on('click', function() {
+ notification.close();
+ }).find('a').on('click', function() {
+ notification.close();
+ self.user_menu.on_menu_settings();
+ return false;
+ });
+ });
+ $icon.appendTo(self.$('.oe_systray'));
+ }
+ });
},
destroy_content: function() {
_.each(_.clone(this.getChildren()), function(el) {