[IMP] website: ease the header and footer visibility management

This commit doesn't introduce any functional change but allows to manage
header and footer visibility with the already existing data-invisible
system. This simplifies the code and avoids doing an RPC at the start of
the `VisibilityPageOptionUpdate` option.

Related to opw-2971181

closes odoo/odoo#107387

X-original-commit: 07fdbc8847d254498b908a1cde0d910a77666f25
Related: odoo/upgrade#4120
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Guillaume (gdi)
2023-02-28 19:08:44 +01:00
parent 934f413c1f
commit 2874b241f4
2 changed files with 2 additions and 8 deletions
@@ -2255,14 +2255,6 @@ const VisibilityPageOptionUpdate = options.Class.extend({
showOptionWidgetName: undefined,
shownValue: '',
/**
* @override
*/
async start() {
await this._super(...arguments);
const shown = await this._isShown();
this.trigger_up('snippet_option_visibility_update', {show: shown});
},
/**
* @override
*/
@@ -206,9 +206,11 @@
</xpath>
<xpath expr="//header" position="attributes">
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if 'header_visible' in main_object and not main_object.header_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if 'header_visible' in main_object and not main_object.header_visible else None</attribute>
</xpath>
<xpath expr="//footer[@id='bottom']" position="attributes">
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if 'footer_visible' in main_object and not main_object.footer_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if 'footer_visible' in main_object and not main_object.footer_visible else None</attribute>
</xpath>
</template>