diff --git a/src/opnsense/mvc/app/views/layouts/default.volt b/src/opnsense/mvc/app/views/layouts/default.volt index 8b13404a4..7ff1687e8 100644 --- a/src/opnsense/mvc/app/views/layouts/default.volt +++ b/src/opnsense/mvc/app/views/layouts/default.volt @@ -53,9 +53,18 @@ }); // hide empty menu items - $('#mainmenu > div > .collapse').each(function(){ + $('#mainmenu > div > .collapse').each(function () { + // cleanup empty second level menu containers + $(this).find("div.collapse").each(function () { + if ($(this).children().length == 0) { + $("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove(); + $(this).remove(); + } + }); + + // cleanup empty first level menu items if ($(this).children().length == 0) { - $("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove(); + $("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove(); } });