usermenu rename templates, only show db in debug, only show company in multicompany

bzr revid: al@openerp.com-20120427221150-j3resq34s4mkazd6
This commit is contained in:
Antony Lesuisse 2012-04-28 00:11:50 +02:00
parent faf7955d83
commit fcfd73cb57
2 changed files with 32 additions and 29 deletions

View File

@ -712,7 +712,7 @@ instance.web.UserMenu = instance.web.Widget.extend({
title: _t("Change Password"),
width : 'auto'
}).open();
this.dialog.$element.html(QWeb.render("Change_Pwd", self));
this.dialog.$element.html(QWeb.render("UserMenu.password", self));
this.dialog.$element.find("form[name=change_password_form]").validate({
submitHandler: function (form) {
self.rpc("/web/session/change_password",{
@ -746,8 +746,11 @@ instance.web.UserMenu = instance.web.Widget.extend({
return;
var func = new instance.web.Model("res.users").get_func("read");
return func(self.session.uid, ["name", "company_id"]).pipe(function(res) {
// TODO: Show company if multicompany is in use
var topbar_name = _.str.sprintf("%s (%s)", res.name, instance.connection.db, res.company_id[1]);
var topbar_name = res.name;
if(instance.connection.debug)
topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.connection.db);
if(res.company_id[0] > 1)
topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]);
self.$element.find('.oe_topbar_name').text(topbar_name);
var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=avatar&id=%s', self.session.prefix, self.session.session_id, self.session.uid);
$avatar.attr('src', avatar_src);
@ -850,7 +853,7 @@ instance.web.UserMenu = instance.web.Widget.extend({
on_menu_about: function() {
var self = this;
self.rpc("/web/webclient/version_info", {}).then(function(res) {
var $help = $(QWeb.render("About-Page", {version_info: res}));
var $help = $(QWeb.render("UserMenu.about", {version_info: res}));
$help.find('a.oe_activate_debug_mode').click(function (e) {
e.preventDefault();
window.location = $.param.querystring(

View File

@ -264,29 +264,6 @@
</div>
</t>
<t t-name="WebClient">
<table class="oe_webclient">
<tr>
<td colspan="2" class="oe_topbar">
<div class="oe_menu_placeholder"/>
<div class="oe_user_menu_placeholder"/>
<div class="oe_systray"/>
</td>
</tr>
<tr>
<td class="oe_leftbar" valign="top">
<a href="#" class="oe_logo"><img t-att-src='_s + "/web/static/src/img/logo.png"'/></a>
<div class="oe_secondary_menus_container"/>
<div class="oe_footer">
Powered by <a href="http://www.openerp.com"><span>Open</span>ERP</a>
</div>
</td>
<td class="oe_application">
</td>
</tr>
</table>
</t>
<t t-name="Menu">
<ul class="oe_menu" t-if="widget.data">
<li t-foreach="widget.data.data.children" t-as="menu">
@ -363,7 +340,7 @@
</a>
</li>
</t>
<t t-name="About-Page">
<t t-name="UserMenu.about">
<div>
<a class="oe_activate_debug_mode" href="?debug" style="float:right; font-size: 80%;">Activate the developper mode</a>
<h1 style="margin:0;">OpenERP</h1>
@ -380,7 +357,7 @@
</p>
</div>
</t>
<t t-name="Change_Pwd">
<t t-name="UserMenu.password">
<form name="change_password_form" class="oe_forms" method="POST">
<table align="center">
<tr>
@ -405,6 +382,29 @@
</form>
</t>
<t t-name="WebClient">
<table class="oe_webclient">
<tr>
<td colspan="2" class="oe_topbar">
<div class="oe_menu_placeholder"/>
<div class="oe_user_menu_placeholder"/>
<div class="oe_systray"/>
</td>
</tr>
<tr>
<td class="oe_leftbar" valign="top">
<a href="#" class="oe_logo"><img t-att-src='_s + "/web/static/src/img/logo.png"'/></a>
<div class="oe_secondary_menus_container"/>
<div class="oe_footer">
Powered by <a href="http://www.openerp.com"><span>Open</span>ERP</a>
</div>
</td>
<td class="oe_application">
</td>
</tr>
</table>
</t>
<t t-name="ViewManager">
<div class="oe_view_manager">
<table class="oe_view_manager_header2">