From b4a159d2614d64aae8570c49ee79121fdb30676c Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 1 Aug 2016 15:33:44 +0200 Subject: [PATCH] [IMP] web, website(_*): use web.layout for every web page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The web modules defines a "layout" template which is only used by the login default page. Now the backend template "web.webclient_bootstrap" and the frontend template "website.layout" both use the "web.layout" template as base. Some parameters can be passed to customize the default "web.layout" template: - "head": content will be placed at the end of the tag of the page - "title": to set the title of the page (the tag should not be placed "by hand") - "x_icon": the url for the page icon - "html_data": dictionnary whose key-value pairs will be placed as attribute-value for the <html> tag - "body_classname": the classname to set on the <body> tag Note: xpath expression on the website.layout template can now only find the #wrapwrap element and its children. An expression "//body" will not have any result. If something has to be added in the body element but not in the #wrapwrap element, simply change the xpath <xpath expr="//body" position="inside"> with <xpath expr="//div[@​id='wrapwrap']" position="after"> --- addons/web/views/webclient_templates.xml | 152 ++++++++--------- .../views/website_navbar_templates.xml | 8 +- addons/website/views/website_templates.xml | 157 +++++++++--------- .../views/website_livechat.xml | 4 +- 4 files changed, 148 insertions(+), 173 deletions(-) diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index ccf01aaa2a1..246f758f4a2 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -189,12 +189,21 @@ </template> <template id="web.layout" name="Web layout"><!DOCTYPE html> - <html style="height: 100%"> + <html t-att="html_data or {}"> <head> + <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <title>Odoo - + + + + <link type="image/x-icon" rel="shortcut icon" t-att-href="x_icon or '/web/static/src/img/favicon.ico'"/> + + <script type="text/javascript"> + var odoo = { + csrf_token: "<t t-esc="request.csrf_token(None)"/>", + }; + </script> + <t t-raw="head or ''"/> </head> <body t-att-class="body_classname"> @@ -205,6 +214,7 @@ <template id="web.login_layout" name="Login Layout"> <t t-call="web.layout"> + <t t-set="html_data" t-value="{'style': 'height: 100%;'}"/> <t t-set="head"> <t t-call-assets="web.assets_common" t-js="false"/> <t t-call-assets="web.assets_frontend" t-js="false"/> @@ -212,6 +222,7 @@ <t t-call-assets="web.assets_frontend" t-css="false"/> </t> <t t-set="body_classname" t-value="'container'"/> + <div class="row"> <div class="col-md-6 col-md-offset-3 o_database_list"> <div class="text-center"> @@ -327,37 +338,33 @@ </a> </template> - <template id="web.qunit_suite"> - <!DOCTYPE html> - <html style="height: 100%"> - <head> - <meta http-equiv="X-UA-Compatible" content="IE=edge"/> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <title>Odoo Web Tests + - - - + diff --git a/addons/website/views/website_navbar_templates.xml b/addons/website/views/website_navbar_templates.xml index 31107d6281c..fc8b29399d0 100644 --- a/addons/website/views/website_navbar_templates.xml +++ b/addons/website/views/website_navbar_templates.xml @@ -2,10 +2,10 @@ -