@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | $grid = $this->add([ |
| 25 | 25 | 'CRUD', |
| 26 | - 'menu' => ActionBar::instance(), |
|
| 26 | + 'menu' => ActionBar::instance(), |
|
| 27 | 27 | // 'model' => HomePage::create(), |
| 28 | 28 | 'displayFields' => ['path', 'role'], |
| 29 | 29 | 'editFields' => ['path', 'role'], |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | // $plugin->extendList('path'); |
| 52 | 52 | |
| 53 | - $grid->addDragHandler()->onReorder(function ($order) { |
|
| 53 | + $grid->addDragHandler()->onReorder(function($order) { |
|
| 54 | 54 | foreach (HomePage::create() as $homepage) { |
| 55 | 55 | $homepage->save(['priority' => array_search($homepage['id'], $order)]); |
| 56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $this->setOrder('priority'); |
| 66 | 66 | |
| 67 | 67 | $this->onHook(\atk4\data\Model::HOOK_BEFORE_INSERT, function($model, & $data) { |
| 68 | - $data['priority'] = $data['priority']?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
| 68 | + $data['priority'] = $data['priority'] ?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
| 69 | 69 | }); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | static $cache; |
| 80 | 80 | |
| 81 | - if (! isset($cache)) { |
|
| 81 | + if (!isset($cache)) { |
|
| 82 | 82 | $cache = []; |
| 83 | 83 | foreach (HomePageJoint::collect() as $joint) { |
| 84 | 84 | $cache[$joint->link()] = $joint->caption(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public static function ofUser() |
| 97 | 97 | { |
| 98 | - if (! $user = Auth::user()) return; |
|
| 98 | + if (!$user = Auth::user()) return; |
|
| 99 | 99 | |
| 100 | 100 | return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
| 101 | 101 | } |
@@ -7,18 +7,18 @@ |
||
| 7 | 7 | |
| 8 | 8 | class SQL extends \atk4\data\Persistence\SQL |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Take a laravel connection and pass it to ATK Data |
|
| 12 | - * |
|
| 13 | - * @return \atk4\data\Persistence\SQL |
|
| 14 | - */ |
|
| 15 | - public function __construct(DatabaseManager $database) |
|
| 16 | - { |
|
| 17 | - $pdo = $database->connection()->getPdo(); |
|
| 10 | + /** |
|
| 11 | + * Take a laravel connection and pass it to ATK Data |
|
| 12 | + * |
|
| 13 | + * @return \atk4\data\Persistence\SQL |
|
| 14 | + */ |
|
| 15 | + public function __construct(DatabaseManager $database) |
|
| 16 | + { |
|
| 17 | + $pdo = $database->connection()->getPdo(); |
|
| 18 | 18 | |
| 19 | - // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
| 20 | - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
| 19 | + // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
| 20 | + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
| 21 | 21 | |
| 22 | - parent::__construct(Connection::connect($pdo)); |
|
| 23 | - } |
|
| 22 | + parent::__construct(Connection::connect($pdo)); |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class NavMenu extends BaseMenu |
| 11 | 11 | { |
| 12 | - public $ui = 'inverted nav menu'; |
|
| 12 | + public $ui = 'inverted nav menu'; |
|
| 13 | 13 | |
| 14 | 14 | // public $defaultTemplate = 'layout/maestro-sidenav.html'; |
| 15 | 15 | |
| 16 | - protected function init(): void |
|
| 16 | + protected function init(): void |
|
| 17 | 17 | { |
| 18 | 18 | parent::init(); |
| 19 | 19 | |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | self::addItems($submenu, collect($subitems)); |
| 65 | 65 | } |
| 66 | 66 | elseif ($subitems = $entry['group'] ?? []) { |
| 67 | - $subgroup = $menu->addGroup($entry['item']); |
|
| 67 | + $subgroup = $menu->addGroup($entry['item']); |
|
| 68 | 68 | |
| 69 | 69 | self::addItems($subgroup, collect($subitems)); |
| 70 | 70 | } |
| 71 | 71 | else { |
| 72 | - $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
| 72 | + $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
| 73 | 73 | } |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->addHeader($this->getApp()->title); |
| 21 | 21 | |
| 22 | 22 | $items = collect(); |
| 23 | - foreach(NavMenuJoint::collect() as $joint) { |
|
| 23 | + foreach (NavMenuJoint::collect() as $joint) { |
|
| 24 | 24 | $items = $items->merge($joint->items()); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public static function addItems($menu, Collection $items) |
| 39 | 39 | { |
| 40 | - $items->sort(function ($entry1, $entry2) { |
|
| 41 | - $weight1 = $entry1['weight']?? 10; |
|
| 42 | - $weight2 = $entry2['weight']?? 10; |
|
| 40 | + $items->sort(function($entry1, $entry2) { |
|
| 41 | + $weight1 = $entry1['weight'] ?? 10; |
|
| 42 | + $weight2 = $entry2['weight'] ?? 10; |
|
| 43 | 43 | |
| 44 | 44 | return $weight1 <=> $weight2; |
| 45 | 45 | })->map(function($entry, $caption) use ($menu) { |
| 46 | - if (! ($entry['access'] ?? true)) return; |
|
| 46 | + if (!($entry['access'] ?? true)) return; |
|
| 47 | 47 | |
| 48 | 48 | if (!is_array($entry)) { |
| 49 | 49 | $entry = ['action' => $entry]; |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | 'icon' => 'th' |
| 40 | 40 | ], new LaunchPad($this)); |
| 41 | 41 | |
| 42 | - foreach(UserMenuJoint::collect() as $joint) { |
|
| 43 | - foreach ($joint->tools()?: [] as $tool) { |
|
| 42 | + foreach (UserMenuJoint::collect() as $joint) { |
|
| 43 | + foreach ($joint->tools() ?: [] as $tool) { |
|
| 44 | 44 | $this->addTool($tool); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - foreach ($joint->entries()?: [] as $entry) { |
|
| 47 | + foreach ($joint->entries() ?: [] as $entry) { |
|
| 48 | 48 | $this->addEntry($entry); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
| 63 | 63 | 'action' => url('logout'), |
| 64 | 64 | 'group' => '10000:user', |
| 65 | - 'callback' => function ($item){ |
|
| 65 | + 'callback' => function($item) { |
|
| 66 | 66 | $logoutForm = \atk4\ui\View::addTo($item, ['attr' => ['method' => 'POST', 'action' => url('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
| 67 | 67 | $logoutForm->id = 'logout-form'; |
| 68 | 68 | \atk4\ui\View::addTo($logoutForm, ['attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function getUserMenuLabel() |
| 81 | 81 | { |
| 82 | - return $this->userMenuLabel?: Auth::user()->name; |
|
| 82 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function addEntry($entry) |
| 86 | 86 | { |
| 87 | 87 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
| 88 | 88 | |
| 89 | - if (! $entry->get('item')) return; |
|
| 89 | + if (!$entry->get('item')) return; |
|
| 90 | 90 | |
| 91 | 91 | $this->entries->add($entry); |
| 92 | 92 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
| 116 | 116 | |
| 117 | - if (! $callback = $entry->get('callback')) continue; |
|
| 117 | + if (!$callback = $entry->get('callback')) continue; |
|
| 118 | 118 | |
| 119 | 119 | $callback($item); |
| 120 | 120 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function __construct($parent) |
| 16 | 16 | { |
| 17 | - $this->parent = $parent; |
|
| 17 | + $this->parent = $parent; |
|
| 18 | 18 | |
| 19 | 19 | parent::__construct('$(this).atkCreateModal([arg])', [ |
| 20 | 20 | 'arg' => [ |
@@ -26,29 +26,29 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | protected function getURL() |
| 29 | - { |
|
| 30 | - return \atk4\ui\VirtualPage::addTo($this->parent)->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
| 31 | - } |
|
| 29 | + { |
|
| 30 | + return \atk4\ui\VirtualPage::addTo($this->parent)->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - protected function getContents(VirtualPage $vp) |
|
| 34 | - { |
|
| 35 | - $vp->add([ |
|
| 36 | - new LaunchButton([ |
|
| 37 | - 'label' => 'Test Button 1', |
|
| 38 | - 'icon' => 'user' |
|
| 39 | - ]) |
|
| 40 | - ])->link(URL::to('/')); |
|
| 41 | - $vp->add([ |
|
| 42 | - new LaunchButton([ |
|
| 43 | - 'label' => 'Test Button 2', |
|
| 44 | - 'icon' => 'car' |
|
| 45 | - ]) |
|
| 46 | - ]); |
|
| 47 | - $vp->add([ |
|
| 48 | - new LaunchButton([ |
|
| 49 | - 'label' => 'Test Button 3', |
|
| 50 | - 'icon' => 'bus' |
|
| 51 | - ]) |
|
| 52 | - ]); |
|
| 53 | - } |
|
| 33 | + protected function getContents(VirtualPage $vp) |
|
| 34 | + { |
|
| 35 | + $vp->add([ |
|
| 36 | + new LaunchButton([ |
|
| 37 | + 'label' => 'Test Button 1', |
|
| 38 | + 'icon' => 'user' |
|
| 39 | + ]) |
|
| 40 | + ])->link(URL::to('/')); |
|
| 41 | + $vp->add([ |
|
| 42 | + new LaunchButton([ |
|
| 43 | + 'label' => 'Test Button 2', |
|
| 44 | + 'icon' => 'car' |
|
| 45 | + ]) |
|
| 46 | + ]); |
|
| 47 | + $vp->add([ |
|
| 48 | + new LaunchButton([ |
|
| 49 | + 'label' => 'Test Button 3', |
|
| 50 | + 'icon' => 'bus' |
|
| 51 | + ]) |
|
| 52 | + ]); |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -7,40 +7,40 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ActionBarItem extends Item |
| 9 | 9 | { |
| 10 | - public $weight = 10; |
|
| 10 | + public $weight = 10; |
|
| 11 | 11 | |
| 12 | - public $callback; |
|
| 12 | + public $callback; |
|
| 13 | 13 | |
| 14 | - public $hint; |
|
| 14 | + public $hint; |
|
| 15 | 15 | |
| 16 | - public function renderView(): void |
|
| 17 | - { |
|
| 18 | - $this->addCallback(); |
|
| 16 | + public function renderView(): void |
|
| 17 | + { |
|
| 18 | + $this->addCallback(); |
|
| 19 | 19 | |
| 20 | - if ($this->hint) { |
|
| 21 | - $this->attr['title'] = $this->hint; |
|
| 22 | - } |
|
| 20 | + if ($this->hint) { |
|
| 21 | + $this->attr['title'] = $this->hint; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - parent::renderView(); |
|
| 25 | - } |
|
| 24 | + parent::renderView(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function callback($callable) |
|
| 28 | - { |
|
| 29 | - $this->callback = $callable; |
|
| 27 | + public function callback($callable) |
|
| 28 | + { |
|
| 29 | + $this->callback = $callable; |
|
| 30 | 30 | |
| 31 | - return $this; |
|
| 32 | - } |
|
| 31 | + return $this; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function addCallback() |
|
| 35 | - { |
|
| 36 | - if (is_callable($callable = $this->callback)) { |
|
| 37 | - $callable = JsCallback::addTo($this)->set($callable); |
|
| 38 | - } |
|
| 34 | + public function addCallback() |
|
| 35 | + { |
|
| 36 | + if (is_callable($callable = $this->callback)) { |
|
| 37 | + $callable = JsCallback::addTo($this)->set($callable); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - if ($callable instanceof JsCallback) { |
|
| 41 | - $this->on('click', $callable); |
|
| 42 | - } |
|
| 40 | + if ($callable instanceof JsCallback) { |
|
| 41 | + $this->on('click', $callable); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return $this; |
|
| 45 | - } |
|
| 44 | + return $this; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class ActionBar extends Menu |
| 10 | 10 | { |
| 11 | - public $ui = 'actionbar menu'; |
|
| 11 | + public $ui = 'actionbar menu'; |
|
| 12 | 12 | |
| 13 | 13 | protected static $buttons = []; |
| 14 | 14 | |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function renderView(): void |
| 50 | - { |
|
| 51 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 52 | - return $element->weight ?? 10; |
|
| 53 | - })->toArray(); |
|
| 50 | + { |
|
| 51 | + $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 52 | + return $element->weight ?? 10; |
|
| 53 | + })->toArray(); |
|
| 54 | 54 | |
| 55 | - parent::renderView(); |
|
| 55 | + parent::renderView(); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public static function addMenuButton($menu) |
| 84 | 84 | { |
| 85 | - return self::instance()->addMenu($menu); |
|
| 85 | + return self::instance()->addMenu($menu); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static function clear() |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | 'icon' => 'arrow left', |
| 23 | 23 | 'weight' => 10000, |
| 24 | 24 | 'attr' => [ |
| 25 | - 'href' => $_SERVER['HTTP_REFERER']?? 'javascript:window.history.back()' |
|
| 25 | + 'href' => $_SERVER['HTTP_REFERER'] ?? 'javascript:window.history.back()' |
|
| 26 | 26 | ], |
| 27 | 27 | ], |
| 28 | 28 | 'save' => [ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function renderView(): void |
| 50 | 50 | { |
| 51 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
| 51 | + $this->elements = collect($this->elements)->sortByDesc(function($element) { |
|
| 52 | 52 | return $element->weight ?? 10; |
| 53 | 53 | })->toArray(); |
| 54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function addItemButton($button, $defaults = []) |
| 66 | 66 | { |
| 67 | - $button = is_string($button)? self::getPredefined($button): $button; |
|
| 67 | + $button = is_string($button) ? self::getPredefined($button) : $button; |
|
| 68 | 68 | |
| 69 | - $button = is_array($button)? new ActionBarItem($button): $button; |
|
| 69 | + $button = is_array($button) ? new ActionBarItem($button) : $button; |
|
| 70 | 70 | |
| 71 | 71 | $actionBar = self::instance(); |
| 72 | 72 | |
@@ -32,53 +32,53 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class LayoutView extends \atk4\ui\Layout//ModuleView |
| 34 | 34 | { |
| 35 | - use SessionTrait; |
|
| 35 | + use SessionTrait; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var View\NavMenu |
|
| 39 | - */ |
|
| 40 | - public $menuLeft; // vertical menu |
|
| 37 | + /** |
|
| 38 | + * @var View\NavMenu |
|
| 39 | + */ |
|
| 40 | + public $menuLeft; // vertical menu |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var \atk4\ui\Menu |
|
| 44 | - */ |
|
| 45 | - public $menu; // horizontal menu |
|
| 42 | + /** |
|
| 43 | + * @var \atk4\ui\Menu |
|
| 44 | + */ |
|
| 45 | + public $menu; // horizontal menu |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var \atk4\ui\Menu |
|
| 49 | - */ |
|
| 50 | - public $menuRight; // vertical pull-down |
|
| 47 | + /** |
|
| 48 | + * @var \atk4\ui\Menu |
|
| 49 | + */ |
|
| 50 | + public $menuRight; // vertical pull-down |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var View\ActionBar |
|
| 54 | - */ |
|
| 55 | - public $actionBar; |
|
| 56 | - public $locationBar; |
|
| 52 | + /** |
|
| 53 | + * @var View\ActionBar |
|
| 54 | + */ |
|
| 55 | + public $actionBar; |
|
| 56 | + public $locationBar; |
|
| 57 | 57 | |
| 58 | - public $burger = true; // burger menu item |
|
| 58 | + public $burger = true; // burger menu item |
|
| 59 | 59 | |
| 60 | - /* |
|
| 60 | + /* |
|
| 61 | 61 | * Whether or not left Menu is visible on Page load. |
| 62 | 62 | */ |
| 63 | - public $isMenuLeftVisible = true; |
|
| 63 | + public $isMenuLeftVisible = true; |
|
| 64 | 64 | |
| 65 | - public $defaultTemplate = 'layout/admin.html'; |
|
| 65 | + public $defaultTemplate = 'layout/admin.html'; |
|
| 66 | 66 | |
| 67 | - protected $location; |
|
| 67 | + protected $location; |
|
| 68 | 68 | |
| 69 | - protected function init(): void |
|
| 70 | - { |
|
| 71 | - parent::init(); |
|
| 69 | + protected function init(): void |
|
| 70 | + { |
|
| 71 | + parent::init(); |
|
| 72 | 72 | |
| 73 | - $this->setMenu(); |
|
| 74 | - $this->setActionBar(); |
|
| 73 | + $this->setMenu(); |
|
| 74 | + $this->setActionBar(); |
|
| 75 | 75 | |
| 76 | 76 | // if (request()->pjax()) return; |
| 77 | 77 | |
| 78 | - $this->setMenuLeft(); |
|
| 79 | - $this->setMenuRight(); |
|
| 78 | + $this->setMenuLeft(); |
|
| 79 | + $this->setMenuRight(); |
|
| 80 | 80 | |
| 81 | - $this->setVersion(); |
|
| 81 | + $this->setVersion(); |
|
| 82 | 82 | |
| 83 | 83 | // $this->js(true, null, 'body')->niceScroll(); |
| 84 | 84 | |
@@ -87,28 +87,28 @@ discard block |
||
| 87 | 87 | // if (event.originalEvent.persisted) { |
| 88 | 88 | // window.location.reload(); |
| 89 | 89 | // }')])); |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - public function setMenu() |
|
| 93 | - { |
|
| 94 | - if ($this->menu) return; |
|
| 92 | + public function setMenu() |
|
| 93 | + { |
|
| 94 | + if ($this->menu) return; |
|
| 95 | 95 | |
| 96 | - $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
|
| 96 | + $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
|
| 97 | 97 | |
| 98 | - // company logo |
|
| 99 | - // see \Epesi\Core\Controller::logo |
|
| 100 | - \atk4\ui\View::addTo($this->menu, ['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add([\atk4\ui\Image::class, url('logo')])->setStyle(['max-height' => '32px']); |
|
| 98 | + // company logo |
|
| 99 | + // see \Epesi\Core\Controller::logo |
|
| 100 | + \atk4\ui\View::addTo($this->menu, ['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add([\atk4\ui\Image::class, url('logo')])->setStyle(['max-height' => '32px']); |
|
| 101 | 101 | |
| 102 | - if ($this->burger) { |
|
| 103 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 104 | - } |
|
| 102 | + if ($this->burger) { |
|
| 103 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | // home icon redirects to /home path |
| 107 | 107 | // see \Epesi\Core\Controller::home |
| 108 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add([\atk4\ui\Icon::class, 'home']); |
|
| 108 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add([\atk4\ui\Icon::class, 'home']); |
|
| 109 | 109 | |
| 110 | 110 | // location bar |
| 111 | - $this->locationBar = $this->menu->add([\atk4\ui\View::class, ['ui' => 'epesi-location']]); |
|
| 111 | + $this->locationBar = $this->menu->add([\atk4\ui\View::class, ['ui' => 'epesi-location']]); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -151,49 +151,49 @@ discard block |
||
| 151 | 151 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function setMenuLeft() |
|
| 155 | - { |
|
| 156 | - if ($this->menuLeft) return; |
|
| 154 | + public function setMenuLeft() |
|
| 155 | + { |
|
| 156 | + if ($this->menuLeft) return; |
|
| 157 | 157 | |
| 158 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
| 158 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
| 159 | 159 | |
| 160 | - if (! $this->burger) return; |
|
| 160 | + if (! $this->burger) return; |
|
| 161 | 161 | |
| 162 | - $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
| 162 | + $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
| 163 | 163 | |
| 164 | - $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
| 165 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 166 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 167 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 168 | - \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
| 169 | - $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
| 170 | - }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
| 171 | - ]); |
|
| 172 | - } |
|
| 164 | + $this->burger->add([\atk4\ui\Icon::class, 'content'])->on('click', [ |
|
| 165 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 166 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 167 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 168 | + \atk4\ui\JsCallback::addTo($this->burger)->set(function($jsCallback, $visible) { |
|
| 169 | + $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
| 170 | + }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
| 171 | + ]); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - public function setActionBar() |
|
| 175 | - { |
|
| 176 | - if ($this->actionBar) return; |
|
| 174 | + public function setActionBar() |
|
| 175 | + { |
|
| 176 | + if ($this->actionBar) return; |
|
| 177 | 177 | |
| 178 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
| 178 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
| 179 | 179 | |
| 180 | - return $this; |
|
| 181 | - } |
|
| 180 | + return $this; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - public function setVersion() |
|
| 184 | - { |
|
| 185 | - $this->template->trySet('version', $this->app->version); |
|
| 186 | - } |
|
| 183 | + public function setVersion() |
|
| 184 | + { |
|
| 185 | + $this->template->trySet('version', $this->app->version); |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * {@inheritdoc} |
|
| 190 | - */ |
|
| 188 | + /** |
|
| 189 | + * {@inheritdoc} |
|
| 190 | + */ |
|
| 191 | 191 | |
| 192 | - public function renderView(): void |
|
| 193 | - { |
|
| 194 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 195 | - $this->menuLeft->addClass('visible'); |
|
| 196 | - } |
|
| 197 | - parent::renderView(); |
|
| 198 | - } |
|
| 192 | + public function renderView(): void |
|
| 193 | + { |
|
| 194 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 195 | + $this->menuLeft->addClass('visible'); |
|
| 196 | + } |
|
| 197 | + parent::renderView(); |
|
| 198 | + } |
|
| 199 | 199 | } |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @var View\NavMenu |
| 39 | 39 | */ |
| 40 | - public $menuLeft; // vertical menu |
|
| 40 | + public $menuLeft; // vertical menu |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var \atk4\ui\Menu |
| 44 | 44 | */ |
| 45 | - public $menu; // horizontal menu |
|
| 45 | + public $menu; // horizontal menu |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @var \atk4\ui\Menu |
| 49 | 49 | */ |
| 50 | - public $menuRight; // vertical pull-down |
|
| 50 | + public $menuRight; // vertical pull-down |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var View\ActionBar |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public $actionBar; |
| 56 | 56 | public $locationBar; |
| 57 | 57 | |
| 58 | - public $burger = true; // burger menu item |
|
| 58 | + public $burger = true; // burger menu item |
|
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | * Whether or not left Menu is visible on Page load. |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $title = []; |
| 124 | 124 | foreach ($crumbs as $level) { |
| 125 | - $label = $level['label']?? $level; |
|
| 126 | - $link = $level['link']?? null; |
|
| 125 | + $label = $level['label'] ?? $level; |
|
| 126 | + $link = $level['link'] ?? null; |
|
| 127 | 127 | |
| 128 | 128 | $crumb->addCrumb($label, $link); |
| 129 | 129 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
| 159 | 159 | |
| 160 | - if (! $this->burger) return; |
|
| 160 | + if (!$this->burger) return; |
|
| 161 | 161 | |
| 162 | 162 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
| 163 | 163 | |
@@ -91,7 +91,9 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function setMenu() |
| 93 | 93 | { |
| 94 | - if ($this->menu) return; |
|
| 94 | + if ($this->menu) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 95 | 97 | |
| 96 | 98 | $this->menu = Menu::addTo($this, ['atk-topMenu fixed horizontal', 'element' => 'header'], ['TopMenu']); |
| 97 | 99 | |
@@ -144,7 +146,9 @@ discard block |
||
| 144 | 146 | |
| 145 | 147 | public function setMenuRight() |
| 146 | 148 | { |
| 147 | - if ($this->menuRight) return; |
|
| 149 | + if ($this->menuRight) { |
|
| 150 | + return; |
|
| 151 | + } |
|
| 148 | 152 | |
| 149 | 153 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
| 150 | 154 | 'ui' => false |
@@ -153,11 +157,15 @@ discard block |
||
| 153 | 157 | |
| 154 | 158 | public function setMenuLeft() |
| 155 | 159 | { |
| 156 | - if ($this->menuLeft) return; |
|
| 160 | + if ($this->menuLeft) { |
|
| 161 | + return; |
|
| 162 | + } |
|
| 157 | 163 | |
| 158 | 164 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
| 159 | 165 | |
| 160 | - if (! $this->burger) return; |
|
| 166 | + if (! $this->burger) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 161 | 169 | |
| 162 | 170 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
| 163 | 171 | |
@@ -173,7 +181,9 @@ discard block |
||
| 173 | 181 | |
| 174 | 182 | public function setActionBar() |
| 175 | 183 | { |
| 176 | - if ($this->actionBar) return; |
|
| 184 | + if ($this->actionBar) { |
|
| 185 | + return; |
|
| 186 | + } |
|
| 177 | 187 | |
| 178 | 188 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
| 179 | 189 | |