mirror of
https://github.com/odoo/design-themes.git
synced 2025-10-07 01:18:52 +07:00
[FIX] test_themes: patch website switcher template
In [1] when all modules were migrated to the new assets system, the
modules in design themes were forgotten.
This commit puts the owl templates into the correct asset.
[1]: https://github.com/odoo/odoo/commit/5410b7c238f211ced2519e53afc99c8468e1f527
closes odoo/design-themes#596
X-original-commit: 9f579f6400
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patch } from 'web.utils';
|
||||
import { useService } from '@web/core/utils/hooks';
|
||||
import { WebsiteSwitcherSystray } from '@website/systray_items/website_switcher';
|
||||
|
||||
const { onMounted, useState } = owl;
|
||||
|
||||
patch(WebsiteSwitcherSystray.prototype, 'test_themes_website_switcher_systray', {
|
||||
setup() {
|
||||
this._super();
|
||||
|
||||
this.orm = useService('orm');
|
||||
this.tooltips = useState({});
|
||||
|
||||
onMounted(async () => {
|
||||
const themesWebsites = await this.orm.call('website', 'get_test_themes_websites_theme_preview');
|
||||
for (const themeId in themesWebsites) {
|
||||
this.tooltips[themeId] = {
|
||||
tooltipTemplate: 'test_themes.ThemeTooltip',
|
||||
tooltipPosition: 'left',
|
||||
tooltipDelay: 100,
|
||||
tooltipInfo: JSON.stringify({url: themesWebsites[themeId]}),
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
template: 'test_themes.WebsiteSwitcherSystray',
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="test_themes.ThemeTooltip" owl="1">
|
||||
<img t-att-src="url" width="150"/>
|
||||
</t>
|
||||
|
||||
<t t-name="test_themes.WebsiteSwitcherSystray" t-inherit="website.WebsiteSwitcherSystray" t-inherit-mode="extension">
|
||||
<xpath expr="//DropdownItem" position="attributes">
|
||||
<attribute name="dataset">this.tooltips[element.id]</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user