From f044bd895712e0e1631d13a1843056cb85c246af Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Wed, 23 Feb 2022 10:19:16 +0100 Subject: [PATCH] chg: [layout:sidebar] Only show collapsible parents if they have children --- templates/element/layouts/sidebar/entry.php | 66 +++++++++++---------- webroot/css/layout.css | 4 ++ 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/templates/element/layouts/sidebar/entry.php b/templates/element/layouts/sidebar/entry.php index 0d7c79c..81949a1 100644 --- a/templates/element/layouts/sidebar/entry.php +++ b/templates/element/layouts/sidebar/entry.php @@ -8,7 +8,7 @@ if (!empty($children)) { $url = "#{$seed}"; } else { - $url = $parent['url'] ?? '#'; + $url = $parent['url'] ?? false; } $controller = \Cake\Utility\Inflector::variable($this->request->getParam('controller')); @@ -59,38 +59,40 @@ ?>
  • - - - > - - Bootstrap->notificationBubble([ - 'variant' => $childHasNotification ? $childNotificationVariant : $notificationVariant, + + + + > + + Bootstrap->notificationBubble([ + 'variant' => $childHasNotification ? $childNotificationVariant : $notificationVariant, + ]); + } + ?> + + + Bootstrap->badge([ + 'text' => $notificationAmount, + 'class' => 'ms-auto', + 'variant' => $notificationVariant, + ]); + } + ?> + + + element('layouts/sidebar/sub-menu', [ + 'seed' => $seed, + 'children' => $children, + 'open' => $hasActiveChild, ]); - } ?> - - - Bootstrap->badge([ - 'text' => $notificationAmount, - 'class' => 'ms-auto', - 'variant' => $notificationVariant, - ]); - } - ?> - - - element('layouts/sidebar/sub-menu', [ - 'seed' => $seed, - 'children' => $children, - 'open' => $hasActiveChild, - ]); - ?> +
  • diff --git a/webroot/css/layout.css b/webroot/css/layout.css index 92a6afe..4625b2b 100644 --- a/webroot/css/layout.css +++ b/webroot/css/layout.css @@ -328,6 +328,10 @@ ul.sidebar-elements > li > a.sidebar-link > * { vertical-align: middle; } +ul.sidebar-elements li.parent .sub-menu > li > a.sidebar-link > i.sidebar-icon { + margin-right: 8px; +} + ul.sidebar-elements > li > a.sidebar-link > i.sidebar-icon { margin-right: 10px; font-size: 19px;