[IMP] Use a systray icon for timezone notification (less intrusive)

bzr revid: fme@openerp.com-20121129213743-w79fh583icui2h2l
This commit is contained in:
Fabien Meghazi 2012-11-29 22:37:43 +01:00
parent bd5c3aa90c
commit 3d75ca8741
4 changed files with 48 additions and 13 deletions

View File

@ -652,7 +652,7 @@
cursor: pointer; cursor: pointer;
} }
.openerp .oe_dropdown_toggle { .openerp .oe_dropdown_toggle {
color: #4C4C4C; color: #4c4c4c;
font-weight: normal; font-weight: normal;
} }
.openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened { .openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened {
@ -795,6 +795,19 @@
.openerp .oe_notification { .openerp .oe_notification {
z-index: 1050; z-index: 1050;
} }
.openerp .oe_webclient_timezone_notification a {
color: white;
text-decoration: underline;
}
.openerp .oe_webclient_timezone_notification p {
margin-top: 1em;
}
.openerp .oe_webclient_timezone_notification dt {
font-weight: bold;
}
.openerp .oe_timezone_systray span {
margin-top: 1px;
}
.openerp .oe_login { .openerp .oe_login {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAKUlEQVQIHWO8e/fufwYsgAUkJigoiCIF5DMyoYggcUiXgNnBiGQKmAkARpcEQeriln4AAAAASUVORK5CYII=);
text-align: center; text-align: center;

View File

@ -671,9 +671,21 @@ $sheet-padding: 16px
border-bottom-right-radius: 8px border-bottom-right-radius: 8px
border-bottom-left-radius: 8px border-bottom-left-radius: 8px
// }}} // }}}
// Notification {{{ // Notifications {{{
.oe_notification .oe_notification
z-index: 1050 z-index: 1050
.oe_webclient_timezone_notification
a
color: white
text-decoration: underline
p
margin-top: 1em
dt
font-weight: bold
.oe_timezone_systray
span
margin-top: 1px
//background-color: white
// }}} // }}}
// Login {{{ // Login {{{
.oe_login .oe_login

View File

@ -1175,18 +1175,23 @@ instance.web.WebClient = instance.web.Client.extend({
browser_offset += _.str.sprintf("%02d", Math.abs(offset / 60)); browser_offset += _.str.sprintf("%02d", Math.abs(offset / 60));
browser_offset += _.str.sprintf("%02d", Math.abs(offset % 60)); browser_offset += _.str.sprintf("%02d", Math.abs(offset % 60));
if (browser_offset !== user_offset) { if (browser_offset !== user_offset) {
var notification = self.do_warn(_t("Timezone"), QWeb.render('WebClient.timezone_notification', { var $icon = $(QWeb.render('WebClient.timezone_systray'));
user_timezone: instance.session.user_context.tz || 'UTC', $icon.on('click', function() {
user_offset: user_offset, var notification = self.do_warn(_t("Timezone"), QWeb.render('WebClient.timezone_notification', {
browser_offset: browser_offset, user_timezone: instance.session.user_context.tz || 'UTC',
}), true); user_offset: user_offset,
notification.element.find('.oe_webclient_timezone_notification').on('click', function() { browser_offset: browser_offset,
notification.close(); }), true);
}).find('a').on('click', function() { notification.element.find('.oe_webclient_timezone_notification').on('click', function() {
notification.close(); notification.close();
self.user_menu.on_menu_settings(); }).find('a').on('click', function() {
return false; $icon.remove();
notification.close();
self.user_menu.on_menu_settings();
return false;
});
}); });
$icon.appendTo(self.$('.oe_systray'));
} }
}); });
}, },

View File

@ -462,6 +462,11 @@
<p><a href="#">Click here to change your user's timezone.</a></p> <p><a href="#">Click here to change your user's timezone.</a></p>
</div> </div>
</t> </t>
<t t-name="WebClient.timezone_systray">
<div class="oe_topbar_item oe_timezone_systray" title="Timezone offset mismatch">
<span class="ui-icon ui-state-error ui-icon-alert"/>
</div>
</t>
<t t-name="EmbedClient"> <t t-name="EmbedClient">
<div class="openerp"> <div class="openerp">