fb23f19c1b
Commit [1] moved the website switcher from the frontend to the backend and in doing so re-factored it into an OWL component. Initially, this refactoring broke the theme preview from the previous widget. This commit re-introduces those previews. [1]: https://github.com/odoo/design-themes/commit/163a8b6fae0d6709d61af81550d1ad77dfe311c9 task-2687506 closes odoo/design-themes#573 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Co-authored-by: Younn Olivier <yol@odoo.com> Co-authored-by: Romain Derie <rde@odoo.com>
30 lines
1001 B
JavaScript
30 lines
1001 B
JavaScript
/** @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',
|
|
});
|