[FIX] theme_test_custo: adapt design themes to the new website builder

Since [this commit], the website builder has been rewritten. Due to it,
`we-` options are deprecated. This commit adapts all the `xpath` to old
options into the new way of doing. This commit also adapts the
`theme_menu_hierarchies` tour for it to work with the new builder.

[this commit]: https://github.com/odoo/odoo/commit/9fe45e2b7ddbbfd0445ffe25a859e67a316d02b2

Related to task-4367641
runbot-223813
runbot-223815

closes odoo/design-themes#1087

Related: odoo/odoo#211725
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Louis (loco)
2025-05-26 15:55:04 +02:00
parent 927b4c86c5
commit 0ce1455aac
9 changed files with 86 additions and 41 deletions
@@ -0,0 +1,20 @@
import { BackgroundShapeOptionPlugin } from "@website/builder/plugins/background_option/background_shape_option_plugin";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
patch(BackgroundShapeOptionPlugin.prototype, {
getBackgroundShapeGroups() {
const bgShapeGroups = super.getBackgroundShapeGroups();
bgShapeGroups.basic.subgroups["custom_shape"] = {
label: "Custom Shapes",
shapes: {
"theme_test_custo/curves/01": {
selectLabel: _t("Curve 01"),
transform: false,
togglableRatio: true,
},
},
};
return bgShapeGroups;
},
});
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- Theme Footer - Option -->
<t t-name="theme_test_custo.FooterTemplateOption" t-inherit="html_builder.FooterTemplateOption" t-inherit-mode="extension">
<xpath expr="//BuilderSelect[@action=&quot;'websiteConfigFooter'&quot;]" position="inside">
<BuilderSelectItem title.translate="Custom Theme"
actionParam="{ view: 'theme_test_custo.template_footer_custom', vars: { 'footer-template': 'custom-theme' } }"
>
<Img src="'/theme_test_custo/static/src/img/template_footer_opt.svg'"/>
</BuilderSelectItem>
</xpath>
</t>
</templates>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- Theme Header - Option -->
<t t-name="theme_test_custo.headerTemplateOption" t-inherit="website.headerTemplateOption" t-inherit-mode="extension">
<xpath expr="//BuilderSelect[@action=&quot;'reloadComposite'&quot;]" position="inside">
<BuilderSelectItem title.translate="Custom Theme"
actionParam="[
{
action: 'websiteConfig',
actionParam: {
views: ['theme_test_custo.template_header_custom'],
vars: {'header-links-style': 'default', 'header-template': 'custom-theme'},
checkVars: false,
},
},
]"
>
<Img src="'/theme_test_custo/static/src/img/template_header_opt.svg'"/>
</BuilderSelectItem>
</xpath>
</t>
</templates>
@@ -0,0 +1,20 @@
import { ImageShapeOptionPlugin } from "@website/builder/plugins/image/image_shape_option_plugin";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
patch(ImageShapeOptionPlugin.prototype, {
getImageShapeGroups() {
const imageShapeGroups = super.getImageShapeGroups();
imageShapeGroups.basic.subgroups["custom_shape"] = {
label: "Custom Shapes",
shapes: {
"theme_test_custo/blob/01": {
selectLabel: _t("Blob 01"),
transform: false,
togglableRatio: true,
},
},
};
return imageShapeGroups;
},
});