nomadjimbob / mikio

Customizable, Bootstrap 4 inspired template for Dokuwiki
GNU General Public License v2.0
22 stars 6 forks source link

Empty elements in the tools page dropdown #88

Open aloade opened 1 week ago

aloade commented 1 week ago

In the top right page, We can access to element for the page in a dropdown, I deactivated most of the element for unlogged users.

Now I have a bunch of titles with no content.

I have a proposal to correct this, I modified the includeDWMenu function in mikio.php with :

line 610, I change the content of the case $value_dropdown with :

            case $value_dropdown:
                if (count($pageToolsMenu) > 0 ) {
                    $html .= '<li id="dokuwiki__pagetools" class="mikio-nav-dropdown">';
                    $html .= '<a id="mikio_dropdown_pagetools" class="nav-link dropdown-toggle" href="#" role="button" 
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' .
                    ($showIcons === true ? $this->mikioInlineIcon('file') : '') .
                    ($showText === true ? $lang['page_tools'] : '<span class="mikio-small-only">' . $lang['page_tools'] .
                    '</span>') . '</a>';
                    $html .= '<div class="mikio-dropdown closed">' . implode('', $pageToolsMenu);

                    $html .= '</div>';
                    $html .= '</li>';
                }

                if (count($siteToolsMenu) > 0 ) {
                    $html .= '<li id="dokuwiki__sitetools" class="mikio-nav-dropdown">';
                    $html .= '<a id="mikio_dropdown_sitetools" class="nav-link dropdown-toggle" href="#" role="button" 
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' .
                        ($showIcons === true ? $this->mikioInlineIcon('gear') : '') .
                        ($showText === true ? $lang['site_tools'] : '<span class="mikio-small-only">' .
                        $lang['site_tools'] . '</span>') . '</a>';

                    $html .= '<div class="mikio-dropdown closed">' . implode('', $siteToolsMenu);

                    $html .= '</div>';
                    $html .= '</li>';
                }

                if (count($userToolsMenu) > 0 ) {
                    $html .= '<li id="dokuwiki__usertools" class="mikio-nav-dropdown">';
                    $html .= '<a id="mikio_dropdown_usertools" class="nav-link dropdown-toggle" href="#" role="button" 
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' .
                        ($showIcons === true ? $this->mikioInlineIcon('user') : '') .
                        ($showText === true ? $lang['user_tools'] : '<span class="mikio-small-only">' .
                        $lang['user_tools'] . '</span>') . '</a>';

                    $html .= '<div class="mikio-dropdown closed">' . implode('', $userToolsMenu);

                    $html .= '</div>';
                    $html .= '</li>';
                }
                break;

in line 649 I change the content of case $value_combine: with :

            case $value_combine:
                $html .= '<li class="mikio-nav-dropdown">';
                $html .= '<a class="mikio-nav-link" href="#">' .
                    ($showIcons === true ? $this->mikioInlineIcon('wrench') : '') .
                    ($showText === true ? tpl_getLang('tools-menu') : '<span class="mikio-small-only">' . tpl_getLang('tools-menu') . '</span>') . '</a>';
                $html .= '<div class="mikio-dropdown closed">';

                if (count($pageToolsMenu) > 0) {
                    $html .= '<h6 class="mikio-dropdown-header">' . $lang['page_tools'] . '</h6>';
                    foreach ($pageToolsMenu as $item) {
                        $html .= $item;
                    }
                }

                if (count($siteToolsMenu) > 0) {
                    count($pageToolsMenu) > 0 ? $html .= '<div class="mikio-dropdown-divider"></div>' : '';
                    $html .= '<h6 class="mikio-dropdown-header">' . $lang['site_tools'] . '</h6>';
                    foreach ($siteToolsMenu as $item) {
                        $html .= $item;
                   }
                }

                if (count($userToolsMenu) > 0) {
                    (count($pageToolsMenu) > 0 || count($siteToolsMenu) > 0 ) ? $html .= '<div class="mikio-dropdown-divider"></div>' : '';
                    $html .= '<h6 class="mikio-dropdown-header">' . $lang['user_tools'] . '</h6>';
                    foreach ($userToolsMenu as $item) {
                        $html .= $item;
                    }
                }

                $html .= '</div>';
                $html .= '</li>';
                break;