rolandtoth / AdminOnSteroids

Various ProcessWire admin tweaks to boost productivity.
https://processwire.com/talk/topic/13389-adminonsteroids/
GNU General Public License v2.0
39 stars 10 forks source link

RestrictTreeDropdown option can result in empty dropdown #105

Closed Toutouwai closed 5 years ago

Toutouwai commented 5 years ago

I use the RestrictTreeDropdown option on all my sites, but have just noticed that if a role does not have any of the following...

...then an empty dropdown under Pages occurs:

2019-02-15_152147

Possible fix

if (RestrictTreeDropdownSettings === true) {

    $('a[href$="/page/list/"]').parent('li').each(function() {
        if(!$(this).siblings().length) $(this).parent().css('visibility', 'hidden');
        $(this).remove();
    });
    $('a[href$="/page/"]').children('i.quicklink-open').remove(); // Reno

}

So if there are no other sibling lis then the parent ul is hidden. The ul can't be removed from the DOM unfortunately because then jQueryUI packs a sad.

rolandtoth commented 5 years ago

Thanks, finally I could also see it (one submenu item was always shown which was a custom AOS NavItem).

I haven't used your code but this CSS:

html.aos ul.pw-dropdown-menu.prnav:empty {
    display: none !important;
}
Toutouwai commented 5 years ago

Thanks!