rolandtoth / AdminOnSteroids

Various ProcessWire admin tweaks to boost productivity.

Home Page:https://processwire.com/talk/topic/13389-adminonsteroids/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RestrictTreeDropdown option can result in empty dropdown

Toutouwai opened this issue · comments

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

  • Page Add shortcut for any templates
  • page-edit-recent permission
  • page-lister permission

...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.

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;
}

Thanks!