@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | return $weight1 <=> $weight2; |
43 | 43 | })->map(function($entry, $caption) use ($menu) { |
44 | - if (! ($entry['access'] ?? true)) return; |
|
44 | + if (! ($entry['access'] ?? true)) { |
|
45 | + return; |
|
46 | + } |
|
45 | 47 | |
46 | 48 | if (!is_array($entry)) { |
47 | 49 | $entry = ['action' => $entry]; |
@@ -60,13 +62,11 @@ discard block |
||
60 | 62 | // $submenu->js = ['transition' => 'swing left', 'on' => 'click']; |
61 | 63 | |
62 | 64 | self::addItems($submenu, collect($subitems)); |
63 | - } |
|
64 | - elseif ($subitems = $entry['group'] ?? []) { |
|
65 | + } elseif ($subitems = $entry['group'] ?? []) { |
|
65 | 66 | $subgroup = $menu->addGroup($entry['item']); |
66 | 67 | |
67 | 68 | self::addItems($subgroup, collect($subitems)); |
68 | - } |
|
69 | - else { |
|
69 | + } else { |
|
70 | 70 | $menu->addItem($entry['item'], $entry['action'] ?? ''); |
71 | 71 | } |
72 | 72 | }); |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
36 | - public $actionBar; |
|
37 | - public $locationBar; |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | + public $actionBar; |
|
37 | + public $locationBar; |
|
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | - /* |
|
41 | + /* |
|
42 | 42 | * Whether or not left Menu is visible on Page load. |
43 | 43 | */ |
44 | - public $isMenuLeftVisible = true; |
|
44 | + public $isMenuLeftVisible = true; |
|
45 | 45 | |
46 | - public $defaultTemplate = 'layout/admin.html'; |
|
46 | + public $defaultTemplate = 'layout/admin.html'; |
|
47 | 47 | |
48 | - protected $location; |
|
48 | + protected $location; |
|
49 | 49 | |
50 | - public function init() |
|
51 | - { |
|
52 | - parent::init(); |
|
50 | + public function init() |
|
51 | + { |
|
52 | + parent::init(); |
|
53 | 53 | |
54 | - $this->setMenu(); |
|
55 | - $this->setActionBar(); |
|
54 | + $this->setMenu(); |
|
55 | + $this->setActionBar(); |
|
56 | 56 | |
57 | 57 | // if (request()->pjax()) return; |
58 | 58 | |
59 | - $this->setMenuLeft(); |
|
60 | - $this->setMenuRight(); |
|
59 | + $this->setMenuLeft(); |
|
60 | + $this->setMenuRight(); |
|
61 | 61 | |
62 | - $this->setVersion(); |
|
62 | + $this->setVersion(); |
|
63 | 63 | |
64 | 64 | // $this->js(true, null, 'body')->niceScroll(); |
65 | 65 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | // if (event.originalEvent.persisted) { |
69 | 69 | // window.location.reload(); |
70 | 70 | // }')])); |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function setMenu() |
|
74 | - { |
|
75 | - if ($this->menu) return; |
|
73 | + public function setMenu() |
|
74 | + { |
|
75 | + if ($this->menu) return; |
|
76 | 76 | |
77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - // company logo |
|
80 | - // see \Epesi\Core\Controller::logo |
|
81 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
79 | + // company logo |
|
80 | + // see \Epesi\Core\Controller::logo |
|
81 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
82 | 82 | |
83 | - if ($this->burger) { |
|
84 | - /** @scrutinizer ignore-call */ |
|
85 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | - } |
|
83 | + if ($this->burger) { |
|
84 | + /** @scrutinizer ignore-call */ |
|
85 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | // home icon redirects to /home path |
89 | 89 | // see \Epesi\Core\Controller::home |
90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
91 | 91 | |
92 | 92 | // location bar |
93 | 93 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -130,50 +130,50 @@ discard block |
||
130 | 130 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
131 | 131 | } |
132 | 132 | |
133 | - public function setMenuLeft() |
|
134 | - { |
|
135 | - if ($this->menuLeft) return; |
|
133 | + public function setMenuLeft() |
|
134 | + { |
|
135 | + if ($this->menuLeft) return; |
|
136 | 136 | |
137 | - $this->menuLeft = $this->add(new View\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
137 | + $this->menuLeft = $this->add(new View\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
138 | 138 | |
139 | - if (! $this->burger) return; |
|
139 | + if (! $this->burger) return; |
|
140 | 140 | |
141 | - if (! session()->get('menu', 1)) { |
|
142 | - $this->isMenuLeftVisible = false; |
|
143 | - } |
|
141 | + if (! session()->get('menu', 1)) { |
|
142 | + $this->isMenuLeftVisible = false; |
|
143 | + } |
|
144 | 144 | |
145 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | - session()->put('menu', $visible? 1: 0); |
|
151 | - session()->save(); |
|
152 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | - ]); |
|
154 | - } |
|
145 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | + session()->put('menu', $visible? 1: 0); |
|
151 | + session()->save(); |
|
152 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | + ]); |
|
154 | + } |
|
155 | 155 | |
156 | - public function setActionBar() |
|
157 | - { |
|
158 | - if ($this->actionBar) return; |
|
156 | + public function setActionBar() |
|
157 | + { |
|
158 | + if ($this->actionBar) return; |
|
159 | 159 | |
160 | - $this->actionBar = $this->add(View\ActionBar::class, 'ActionBar'); |
|
161 | - } |
|
160 | + $this->actionBar = $this->add(View\ActionBar::class, 'ActionBar'); |
|
161 | + } |
|
162 | 162 | |
163 | - public function setVersion() |
|
164 | - { |
|
165 | - $this->template->trySet('version', $this->app->version); |
|
166 | - } |
|
163 | + public function setVersion() |
|
164 | + { |
|
165 | + $this->template->trySet('version', $this->app->version); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * {@inheritdoc} |
|
170 | - */ |
|
168 | + /** |
|
169 | + * {@inheritdoc} |
|
170 | + */ |
|
171 | 171 | |
172 | - public function renderView() |
|
173 | - { |
|
174 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | - $this->menuLeft->addClass('visible'); |
|
176 | - } |
|
177 | - parent::renderView(); |
|
178 | - } |
|
172 | + public function renderView() |
|
173 | + { |
|
174 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | + $this->menuLeft->addClass('visible'); |
|
176 | + } |
|
177 | + parent::renderView(); |
|
178 | + } |
|
179 | 179 | } |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | 36 | public $actionBar; |
37 | 37 | public $locationBar; |
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | 41 | /* |
42 | 42 | * Whether or not left Menu is visible on Page load. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
91 | 91 | |
92 | 92 | // location bar |
93 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
93 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function setLocation($crumbs) |
@@ -136,20 +136,20 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->menuLeft = $this->add(new View\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
138 | 138 | |
139 | - if (! $this->burger) return; |
|
139 | + if (!$this->burger) return; |
|
140 | 140 | |
141 | - if (! session()->get('menu', 1)) { |
|
141 | + if (!session()->get('menu', 1)) { |
|
142 | 142 | $this->isMenuLeftVisible = false; |
143 | 143 | } |
144 | 144 | |
145 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
145 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | 146 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
147 | 147 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
148 | 148 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
149 | 149 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
150 | - session()->put('menu', $visible? 1: 0); |
|
150 | + session()->put('menu', $visible ? 1 : 0); |
|
151 | 151 | session()->save(); |
152 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
152 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
153 | 153 | ]); |
154 | 154 | } |
155 | 155 |
@@ -72,7 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | public function setMenu() |
74 | 74 | { |
75 | - if ($this->menu) return; |
|
75 | + if ($this->menu) { |
|
76 | + return; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
78 | 80 | |
@@ -123,7 +125,9 @@ discard block |
||
123 | 125 | |
124 | 126 | public function setMenuRight() |
125 | 127 | { |
126 | - if ($this->menuRight) return; |
|
128 | + if ($this->menuRight) { |
|
129 | + return; |
|
130 | + } |
|
127 | 131 | |
128 | 132 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
129 | 133 | 'ui' => false |
@@ -132,11 +136,15 @@ discard block |
||
132 | 136 | |
133 | 137 | public function setMenuLeft() |
134 | 138 | { |
135 | - if ($this->menuLeft) return; |
|
139 | + if ($this->menuLeft) { |
|
140 | + return; |
|
141 | + } |
|
136 | 142 | |
137 | 143 | $this->menuLeft = $this->add(new View\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
138 | 144 | |
139 | - if (! $this->burger) return; |
|
145 | + if (! $this->burger) { |
|
146 | + return; |
|
147 | + } |
|
140 | 148 | |
141 | 149 | if (! session()->get('menu', 1)) { |
142 | 150 | $this->isMenuLeftVisible = false; |
@@ -155,7 +163,9 @@ discard block |
||
155 | 163 | |
156 | 164 | public function setActionBar() |
157 | 165 | { |
158 | - if ($this->actionBar) return; |
|
166 | + if ($this->actionBar) { |
|
167 | + return; |
|
168 | + } |
|
159 | 169 | |
160 | 170 | $this->actionBar = $this->add(View\ActionBar::class, 'ActionBar'); |
161 | 171 | } |