Browse Source

+ minimized menu

master
dimti 5 years ago
parent
commit
0507d8b8cd
  1. 11
      Plugin.php
  2. 20
      assets/css/_wms_extend_menu.css
  3. 6
      helpers/Menu.php
  4. 4
      partials/menu/main/_system_sidebar.phtml

11
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()

20
assets/css/_wms_extend_menu.css

@ -8,4 +8,22 @@
.layout-cell.layout-sidenav-container ~ .layout-cell.sidenav-tree {
border: none;
}
}
}
.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; }

6
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");
}
}
}

4
partials/menu/main/_system_sidebar.phtml

@ -11,7 +11,7 @@
'context' => $context,
]) ?>
<?php else: ?>
<div class="layout-cell sidenav-tree bg-p" data-control="sidenav-tree" data-search-input="#settings-search-input">
<div class="layout-cell sidenav-tree bg-p <?=\Wms\Menu\Helpers\Menu::$minimizedCurrentMainMenu?:'';?>" data-control="sidenav-tree" data-search-input="#settings-search-input">
<a class="back-link" href="<?= Backend::url('wms/menu') ?>"><i class="icon-angle-left"></i><?= e(trans('wms.menu::plugin.name')) ?></a>
<div class="layout">
@ -33,4 +33,4 @@
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
Loading…
Cancel
Save