Files
odoo_source/addons/website/static/tests/website_service_mock.js
T
Younn Olivier 78c59afd13 [FIX] website, *: fix the website custom systray and menus in mobile
*: website_event, website_links

This commit fixes the navbar on the enterprise mobile mode. With the
enterprise modules, in mobile mode, the navbar menus are removed and
displayed in an an additional systray item, the BurgerMenu.

This behavior was not adapted to the website systray and contextual
custom menus, introduced in [1].

For the website systray, some elements are hidden in mobile:
- the "edit" and "translate" buttons,
- the mobile preview,
- the "+ new" new content button,

The logic for displaying the contextual custom menus is moved from the
navbar patch to a service, so that we can define a patch for the
BurgerMenu that uses that logic and has the same behavior as the
navbar.
For now, the "Menu Editor" and the "HTML/CSS Editor" menus are hidden in
mobile.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-2687506

closes odoo/odoo#99605

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 17:33:11 +02:00

51 lines
1.4 KiB
JavaScript

/** @odoo-module */
import { patch } from '@web/core/utils/patch';
import { registry } from '@web/core/registry';
import { utils, clearRegistryWithCleanup } from '@web/../tests/helpers/mock_env';
const { prepareRegistriesWithCleanup } = utils;
function makeFakeWebsiteService() {
return {
start() {
return {
get context() {
return {};
},
get isRestrictedEditor() {
return true;
},
get hasMultiWebsites() {
return true;
},
async fetchUserGroups() {},
};
}
};
}
function makeFakeWebsiteCustomMenusService() {
return {
start() {
return {
get() {},
open() {},
addCustomMenus(sections) {
return sections;
},
};
}
};
}
const serviceRegistry = registry.category('services');
patch(utils, 'website_test_registries', {
prepareRegistriesWithCleanup() {
prepareRegistriesWithCleanup(...arguments);
serviceRegistry.add('website', makeFakeWebsiteService());
serviceRegistry.add('website_custom_menus', makeFakeWebsiteCustomMenusService());
clearRegistryWithCleanup(registry.category('website_systray'));
},
});