mirror of https://github.com/OCA/web.git
[IMP] web_responsive: Performance when hide menus
parent
1e39ee2a2d
commit
46e6fb334f
|
@ -5,7 +5,7 @@
|
|||
{
|
||||
"name": "Web Responsive",
|
||||
"summary": "Responsive web client, community-supported",
|
||||
"version": "12.0.1.1.3",
|
||||
"version": "12.0.1.1.4",
|
||||
"category": "Website",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"author": "LasLabs, Tecnativa, Alexandre Díaz, "
|
||||
|
|
|
@ -435,6 +435,8 @@ odoo.define('web_responsive', function (require) {
|
|||
/**
|
||||
* Because the menu aren't closed when click, this method
|
||||
* searchs for the menu with the action executed to close it.
|
||||
* To avoid delays in pages with a lot of DOM nodes we make
|
||||
* 'sub-groups' with 'querySelector' to improve the performance.
|
||||
*
|
||||
* @param {action} action
|
||||
* The executed action
|
||||
|
@ -442,17 +444,20 @@ odoo.define('web_responsive', function (require) {
|
|||
_hideMenusByAction: function (action) {
|
||||
var uniq_sel = '[data-action-id='+action.id+']';
|
||||
// Need close AppDrawer?
|
||||
$(_.str.sprintf(
|
||||
'.o_menu_apps .dropdown:has(.dropdown-menu.show:has(%s)) > a',
|
||||
uniq_sel)).dropdown('toggle');
|
||||
var menu_apps_dropdown = document.querySelector(
|
||||
'.o_menu_apps .dropdown');
|
||||
$(menu_apps_dropdown).has('.dropdown-menu.show')
|
||||
.has(uniq_sel).find('> a').dropdown('toggle');
|
||||
// Need close Sections Menu?
|
||||
// TODO: Change to 'hide' in modern Bootstrap >4.1
|
||||
$(_.str.sprintf(
|
||||
'.o_menu_sections li.show:has(%s) .dropdown-toggle', uniq_sel))
|
||||
var menu_sections = document.querySelector(
|
||||
'.o_menu_sections li.show');
|
||||
$(menu_sections).has(uniq_sel).find('.dropdown-toggle')
|
||||
.dropdown('toggle');
|
||||
// Need close Mobile?
|
||||
$(_.str.sprintf('.o_menu_sections.show:has(%s)', uniq_sel))
|
||||
.collapse('hide');
|
||||
var menu_sections_mobile = document.querySelector(
|
||||
'.o_menu_sections.show');
|
||||
$(menu_sections_mobile).has(uniq_sel).collapse('hide');
|
||||
},
|
||||
|
||||
_handleAction: function (action) {
|
||||
|
|
Loading…
Reference in New Issue