[FIX] odoo_theme: handle non-TOC pages when expanding top menu entries
Trying to "expand" those pages lead to a crash that prevented the menu to be shown at all. Incidentally, this commit also handles menus built with `make fast`. closes odoo/documentation#3275 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
parent
0ef10a1606
commit
9af7a4ca01
@ -78,8 +78,11 @@
|
|||||||
* @param {HTMLElement} navigationMenu - The navigation menu.
|
* @param {HTMLElement} navigationMenu - The navigation menu.
|
||||||
*/
|
*/
|
||||||
const _expandTopMenus = navigationMenu => {
|
const _expandTopMenus = navigationMenu => {
|
||||||
navigationMenu.querySelectorAll('.toctree-l1').forEach(element => {
|
navigationMenu.querySelectorAll('.toctree-l1').forEach(tocEntry => {
|
||||||
element.querySelector('ul').classList.add('show'); // Expand the top-level menus.
|
const childTocEntryList = tocEntry.querySelector('ul');
|
||||||
|
if (childTocEntryList) { // The TOC entry has an associated TOC entry list.
|
||||||
|
childTocEntryList.classList.add('show'); // Expand the top-level menus.
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user