diff --git a/app/CMS/Handlers/BaseHandler.php b/app/CMS/Handlers/BaseHandler.php index 2dbff17e..9739ac09 100644 --- a/app/CMS/Handlers/BaseHandler.php +++ b/app/CMS/Handlers/BaseHandler.php @@ -3,7 +3,6 @@ namespace App\CMS\Handlers; use App\CMS\Contracts\Modules\BaseModuleHandler; -use App\CMS\Enumerations\TemplatePathsHumanReadableRootOnly; use App\CMS\Enumerations\WidgetTypes; use App\CMS\Repositories\Module; use App\Models\ActionLog\ActionLog; @@ -14,6 +13,7 @@ use App\Models\Templates\Template; use App\Models\User; use App\Models\Widgets\Widget; use App\Models\Widgets\WidgetArea; +use Mcamara\LaravelLocalization\Facades\LaravelLocalization; abstract class BaseHandler implements BaseModuleHandler { @@ -125,6 +125,26 @@ abstract class BaseHandler implements BaseModuleHandler }, 10000, ['icon' => 'fa fa-fw fa-gears']); }); + \Menu::create('topMenu', function ($menu) use ($user) { + if (count(LaravelLocalization::getSupportedLocales()) > 1) { + $menu->dropdown(trans(LaravelLocalization::getCurrentLocaleName()), function ($menu) use ($user) { + foreach (LaravelLocalization::getSupportedLocales() as $localeCode => $properties) { + $menu->url(LaravelLocalization::getLocalizedURL($localeCode), $properties['native']); + } + }); + } + + if ($user->can('manage', Content::class)) { + $menu->route('page.index', '', [], 10, [ + 'icon' => 'fa fa-fw fa-globe', + 'title' => trans('common.goToWeb'), + 'target' => '_blank', + 'data-toggle' => 'tooltip', + 'data-placement' => 'left' + ]); + } + }); + // create menu with user profile \Menu::create('profileMenu', function ($menu) use ($user) { $menu->route('users.detail', trans('admin/userManagement.profile'), ['user' => $user], 10, ['icon' => 'fa fa-fw fa-user icon']); diff --git a/app/CMS/MenuPresenters/FoundationDrilldownMenuPresenter.php b/app/CMS/MenuPresenters/FoundationDrilldownMenuPresenter.php deleted file mode 100644 index 7d24c744..00000000 --- a/app/CMS/MenuPresenters/FoundationDrilldownMenuPresenter.php +++ /dev/null @@ -1,83 +0,0 @@ -' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getCloseTagWrapper() - { - return PHP_EOL . '' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getMenuWithoutDropdownWrapper($item) - { - return 'getActiveState($item) . '>' . $item->getIcon() . ' ' . $item->title . '' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getActiveState(MenuItem $item) - { - $active = ' class="active"'; - - if (empty($item->getChilds())) { - // for direct menu input return if page is active - return \Request::is($item->getRequest()) ? $active : null; - } else { - // on nested menu inputs loop over children and in case any of them is active, mark active also root level - foreach ($item->getChilds() as $child) { - if ($this->getActiveState($child)) { - return $active; - } - } - } - - return null; - } - - /** - * {@inheritdoc } - */ - public function getDividerWrapper() - { - return '
  • ' . PHP_EOL; - } - - public function getMultiLevelDropdownWrapper($item) - { - return $this->getMenuWithDropDownWrapper($item); - } - - /** - * {@inheritdoc } - */ - public function getMenuWithDropDownWrapper($item) - { - $active = $this->getActiveState($item); - - return '
  • - ' . $item->getIcon() . ' ' . $item->title . ' - -
  • ' . PHP_EOL; - } -} \ No newline at end of file diff --git a/app/CMS/MenuPresenters/FoundationDropdownMenuPresenter.php b/app/CMS/MenuPresenters/FoundationDropdownMenuPresenter.php deleted file mode 100644 index 7a2bbd6a..00000000 --- a/app/CMS/MenuPresenters/FoundationDropdownMenuPresenter.php +++ /dev/null @@ -1,62 +0,0 @@ -' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getCloseTagWrapper() - { - return PHP_EOL . '' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getMenuWithoutDropdownWrapper($item) - { - $link = '' . $item->getIcon() . ' ' . $item->title . ''; - return 'getActiveState($item) . '>' . $link . '' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getActiveState($item) - { - return \Request::is($item->getRequest()) || $item->hasActiveOnChild ? ' class="active"' : null; - } - - /** - * {@inheritdoc } - */ - public function getDividerWrapper() - { - return '
  • ' . PHP_EOL; - } - - /** - * {@inheritdoc } - */ - public function getMenuWithDropDownWrapper($item) - { - return '
  • - ' . $item->getIcon() . ' ' . $item->title . ' - -
  • ' . PHP_EOL; - } -} \ No newline at end of file diff --git a/app/CMS/MenuPresenters/FoundationInitializedDropdownMenuPresenter.php b/app/CMS/MenuPresenters/FoundationInitializedDropdownMenuPresenter.php deleted file mode 100644 index 79360f95..00000000 --- a/app/CMS/MenuPresenters/FoundationInitializedDropdownMenuPresenter.php +++ /dev/null @@ -1,10 +0,0 @@ -' . PHP_EOL; - } -} \ No newline at end of file diff --git a/app/CMS/MenuPresenters/TopMenuPresenter.php b/app/CMS/MenuPresenters/TopMenuPresenter.php new file mode 100644 index 00000000..ed9938c0 --- /dev/null +++ b/app/CMS/MenuPresenters/TopMenuPresenter.php @@ -0,0 +1,16 @@ + [ - 'foundation-drilldown' => App\CMS\MenuPresenters\FoundationDrilldownMenuPresenter::class, - 'foundation-dropdown' => App\CMS\MenuPresenters\FoundationDropdownMenuPresenter::class, - 'foundation-dropdown-initialized' => App\CMS\MenuPresenters\FoundationInitializedDropdownMenuPresenter::class, - 'metismenu' => App\CMS\MenuPresenters\MetismenuPresenter::class, - 'profile-menu' => App\CMS\MenuPresenters\ProfileMenuPresenter::class, + 'metismenu' => App\CMS\MenuPresenters\MetismenuPresenter::class, + 'profile-menu' => App\CMS\MenuPresenters\ProfileMenuPresenter::class, + 'top-menu' => \App\CMS\MenuPresenters\TopMenuPresenter::class ], 'ordering' => true, diff --git a/resources/assets/admin/css/custom.css b/resources/assets/admin/css/custom.css index 2f18e612..24a460ce 100644 --- a/resources/assets/admin/css/custom.css +++ b/resources/assets/admin/css/custom.css @@ -427,3 +427,15 @@ img { padding-left: 35px; } +.nav-profile .dropdown-menu > li { + width: 100%; + padding: 3px 1.5rem; + clear: both; + font-weight: normal; + color: #373a3c; + text-align: inherit; + white-space: nowrap; + background: none; + border: 0; + +} \ No newline at end of file diff --git a/resources/views/admin/layoutWithNavigation.blade.php b/resources/views/admin/layoutWithNavigation.blade.php index ac2bb9c3..db9c819e 100644 --- a/resources/views/admin/layoutWithNavigation.blade.php +++ b/resources/views/admin/layoutWithNavigation.blade.php @@ -22,29 +22,11 @@
    -