diff --git a/Plugin.php b/Plugin.php index 9eb1305..cdaf208 100644 --- a/Plugin.php +++ b/Plugin.php @@ -6,13 +6,16 @@ use Backend\Classes\Controller as BackendController; use Cms\Classes\Controller as CmsController; use Cms\Classes\Page as CmsPage; use System\Classes\PluginBase; +use System\Traits\AssetMaker; /** * Menu Plugin Information File */ class Plugin extends PluginBase { - protected const ICON = 'icon-sliders'; + const ICON = 'icon-sliders'; + + use AssetMaker; /** * @var CmsController @@ -77,6 +80,12 @@ class Plugin extends PluginBase $config = $page->theme->getConfig(); $page->theme->menu = $this->getMenu(optional($config)['menu'] ?: [], !!optional($config)['pageTitleMoreImportant']); }); + + \Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) { + $this->addCss('/plugins/wms/menu/assets/css/_wms_extend_menu.css'); + + \Block::append('head', $this->makeAssets('css')); + }); } public function registerNavigation() diff --git a/assets/css/_wms_extend_menu.css b/assets/css/_wms_extend_menu.css index 6cfedc3..eee654c 100644 --- a/assets/css/_wms_extend_menu.css +++ b/assets/css/_wms_extend_menu.css @@ -8,4 +8,22 @@ .layout-cell.layout-sidenav-container ~ .layout-cell.sidenav-tree { border: none; } -} \ No newline at end of file +} +.sidenav-tree.minimized { + width: 50px; } +.sidenav-tree.minimized li .header { + display: none; } +.sidenav-tree.minimized li .description { + display: none; } +.sidenav-tree.minimized ul.top-level > li > div.group h3 { + font-size: 0.8rem; + text-align: center; + padding: 5px 0; } +.sidenav-tree.minimized ul.top-level > li[data-status=collapsed] > div.group h3:before { + display: none; } +.sidenav-tree.minimized ul.top-level > li > div.group h3:before { + display: none; } +.sidenav-tree.minimized ul.top-level > li > ul li a i { + top: 9px; + left: 13px; + font-size: 18px; } diff --git a/helpers/Menu.php b/helpers/Menu.php index f566ea8..72e6e39 100644 --- a/helpers/Menu.php +++ b/helpers/Menu.php @@ -2,8 +2,10 @@ namespace Wms\Menu\Helpers; -class Menu +abstract class Menu { + public static $minimizedCurrentMainMenu = false; + public static function setMainActive($sideMenuItemCode = null) { \BackendMenu::setContext('Wms.Menu', 'main', $sideMenuItemCode); @@ -13,4 +15,4 @@ class Menu { \BackendMenu::setContext('Wms.Menu', 'main', "$mainMenuItemCode|$sideMenuItemCode"); } -} \ No newline at end of file +} diff --git a/partials/menu/main/_system_sidebar.phtml b/partials/menu/main/_system_sidebar.phtml index 17ecdae..c840509 100644 --- a/partials/menu/main/_system_sidebar.phtml +++ b/partials/menu/main/_system_sidebar.phtml @@ -11,7 +11,7 @@ 'context' => $context, ]) ?> -
+
@@ -33,4 +33,4 @@
- \ No newline at end of file +