summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Vray <bvr@odoo.com>2020-06-30 13:23:20 +0000
committerqsm-odoo <qsm@odoo.com>2020-06-30 14:19:16 +0000
commit7827da3e7a00a3d93bcbe114179f7a73000431a1 (patch)
treea10e1d7a4981cb947684ad04765580f1a50f6f09
parent904fea38a25b76b53f5e622e068e6b8e74ff0acb (diff)
[IMP] website: add the possibility to hide the logo
Part of https://github.com/odoo/odoo/pull/49142 task-2229551
-rw-r--r--addons/website/static/src/js/editor/snippets.options.js21
-rw-r--r--addons/website/views/snippets/snippets.xml13
-rw-r--r--addons/website/views/website_templates.xml6
3 files changed, 35 insertions, 5 deletions
diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js
index 655692237f2..c9d3efad3dc 100644
--- a/addons/website/static/src/js/editor/snippets.options.js
+++ b/addons/website/static/src/js/editor/snippets.options.js
@@ -1518,6 +1518,27 @@ options.registry.collapse = options.Class.extend({
},
});
+options.registry.Header = options.Class.extend({
+
+ //--------------------------------------------------------------------------
+ // Private
+ //--------------------------------------------------------------------------
+
+ /**
+ * Needs to be done manually for now because data-dependencies
+ * doesn't work with "AND" conditions.
+ * TODO: improve this.
+ *
+ * @override
+ */
+ async _computeWidgetVisibility(widgetName, params) {
+ if (widgetName === 'option_logo_height_scrolled') {
+ return !this.$('.navbar-brand').hasClass('d-none');
+ }
+ return this._super(...arguments);
+ },
+});
+
options.registry.topMenuTransparency = options.Class.extend({
//--------------------------------------------------------------------------
diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml
index 6b71320c7b1..afa6e9fc90a 100644
--- a/addons/website/views/snippets/snippets.xml
+++ b/addons/website/views/snippets/snippets.xml
@@ -409,7 +409,8 @@
data-selector="[data-oe-expression='res_company.partner_id']"
data-no-check="true"/>
- <div id="so_header_theme"
+ <div data-js="Header"
+ id="so_header_theme"
data-selector="#wrapwrap > header"
data-no-check="true"
groups="website.group_website_designer">
@@ -424,19 +425,21 @@
<we-select string="Logo" data-reload="/">
<we-button data-customize-website-views="website.website_name">Text</we-button>
<we-button data-customize-website-views="website.layout_logo_show">Image</we-button>
+ <we-button data-customize-website-views="website.header_logo_none" data-name="header_logo_none_opt">None</we-button>
</we-select>
<we-input string="Logo Height"
+ data-dependencies="!header_logo_none_opt"
data-customize-website-variable="null"
data-variable="logo-height"
data-unit="px"
data-save-unit="rem"/>
- <we-input id="option_logo_height_scrolled"
- string="Logo Height (Scrolled)"
+ <we-input string="Logo Height (Scrolled)"
+ data-name="option_logo_height_scrolled"
+ data-dependencies="!header_visibility_scroll_opt"
data-customize-website-variable="null"
data-variable="fixed-logo-height"
data-unit="px"
- data-save-unit="rem"
- data-dependencies="!header_visibility_scroll_opt"/>
+ data-save-unit="rem"/>
<we-row string="Font">
<we-fontfamilypicker data-variable="navbar-font-number"/>
<we-input data-customize-website-variable="null" data-variable="header-font-size" data-unit="px" data-save-unit="rem"/>
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index 5483fa70af1..4621b424c01 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -255,6 +255,12 @@
</xpath>
</template>
+<template id="header_logo_none" inherit_id="website.layout" name="No Logo" active="False">
+ <xpath expr="//header//a[hasclass('navbar-brand')]" position="replace">
+ <a href="/" class="navbar-brand d-none"/>
+ </xpath>
+</template>
+
<template id="header_visibility_standard" inherit_id="website.layout" name="Header Visibility Standard">
<xpath expr="//header" position="attributes">
<attribute name="t-attf-class" add="o_header_standard o_top_fixed_element" separator=" "/>