@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | 'title' => __('Launchpad'), |
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | - foreach(UserMenuJoint::collect() as $joint) { |
|
| 42 | - foreach ($joint->tools()?: [] as $tool) { |
|
| 41 | + foreach (UserMenuJoint::collect() as $joint) { |
|
| 42 | + foreach ($joint->tools() ?: [] as $tool) { |
|
| 43 | 43 | $this->addTool($tool); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - foreach ($joint->entries()?: [] as $entry) { |
|
| 46 | + foreach ($joint->entries() ?: [] as $entry) { |
|
| 47 | 47 | $this->addEntry($entry); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
| 62 | 62 | 'action' => url('logout'), |
| 63 | 63 | 'group' => '10000:user', |
| 64 | - 'callback' => function ($item){ |
|
| 64 | + 'callback' => function($item) { |
|
| 65 | 65 | $logoutForm = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => URL::to('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
| 66 | 66 | $logoutForm->id = 'logout-form'; |
| 67 | 67 | $logoutForm->add(['View', 'attr' => ['type' => 'hidden', 'name' => '_token', 'value' => csrf_token()]])->setElement('input'); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
| 75 | 75 | |
| 76 | - if (! $entry->get('item')) return; |
|
| 76 | + if (!$entry->get('item')) return; |
|
| 77 | 77 | |
| 78 | 78 | $this->entries->add($entry); |
| 79 | 79 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
| 103 | 103 | |
| 104 | - if (! $callback = $entry->get('callback')) continue; |
|
| 104 | + if (!$callback = $entry->get('callback')) continue; |
|
| 105 | 105 | |
| 106 | 106 | $callback($item); |
| 107 | 107 | } |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
| 75 | 75 | |
| 76 | - if (! $entry->get('item')) return; |
|
| 76 | + if (! $entry->get('item')) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | 80 | $this->entries->add($entry); |
| 79 | 81 | } |
@@ -94,14 +96,18 @@ discard block |
||
| 94 | 96 | { |
| 95 | 97 | $empty = true; |
| 96 | 98 | foreach ($this->entries->groupBy('group')->sortKeys() as $group) { |
| 97 | - if (!$empty) $this->userMenu->addDivider(); |
|
| 99 | + if (!$empty) { |
|
| 100 | + $this->userMenu->addDivider(); |
|
| 101 | + } |
|
| 98 | 102 | |
| 99 | 103 | foreach ($group->sortBy('weight') as $entry) { |
| 100 | 104 | $empty = false; |
| 101 | 105 | |
| 102 | 106 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
| 103 | 107 | |
| 104 | - if (! $callback = $entry->get('callback')) continue; |
|
| 108 | + if (! $callback = $entry->get('callback')) { |
|
| 109 | + continue; |
|
| 110 | + } |
|
| 105 | 111 | |
| 106 | 112 | $callback($item); |
| 107 | 113 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | protected function prepareButtons() |
| 61 | 61 | { |
| 62 | - foreach (self::$buttons->sortByDesc(function ($button) { |
|
| 62 | + foreach (self::$buttons->sortByDesc(function($button) { |
|
| 63 | 63 | return $button->weight; |
| 64 | 64 | }) as $button) { |
| 65 | 65 | $this->add($button); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public static function addButtons($buttons) |
| 85 | 85 | { |
| 86 | - foreach (is_array($buttons)? $buttons: [$buttons] as $button) { |
|
| 86 | + foreach (is_array($buttons) ? $buttons : [$buttons] as $button) { |
|
| 87 | 87 | self::addButton($button); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -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 $this->parent->add('VirtualPage')->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut'); |
|
| 31 | - } |
|
| 29 | + { |
|
| 30 | + return $this->parent->add('VirtualPage')->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 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $this->addHeader($this->app->title); |
| 18 | 18 | |
| 19 | 19 | $items = collect(); |
| 20 | - foreach(NavMenuJoint::collect() as $joint) { |
|
| 20 | + foreach (NavMenuJoint::collect() as $joint) { |
|
| 21 | 21 | $items = $items->merge($joint->items()); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public static function addItems($menu, Collection $items) |
| 36 | 36 | { |
| 37 | - $items->sort(function ($entry1, $entry2) { |
|
| 37 | + $items->sort(function($entry1, $entry2) { |
|
| 38 | 38 | $weight1 = $entry1['weight']?? 10; |
| 39 | 39 | $weight2 = $entry2['weight']?? 10; |
| 40 | 40 | |
| 41 | 41 | return $weight1 <=> $weight2; |
| 42 | 42 | })->map(function($item, $caption) use ($menu) { |
| 43 | - if (! ($item['access']?? true)) return; |
|
| 43 | + if (!($item['access']?? true)) return; |
|
| 44 | 44 | |
| 45 | 45 | if (!isset($item['link']) && !is_array($item)) { |
| 46 | 46 | $item = [ |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | return $weight1 <=> $weight2; |
| 42 | 42 | })->map(function($item, $caption) use ($menu) { |
| 43 | - if (! ($item['access']?? true)) return; |
|
| 43 | + if (! ($item['access']?? true)) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | if (!isset($item['link']) && !is_array($item)) { |
| 46 | 48 | $item = [ |
@@ -58,8 +60,7 @@ discard block |
||
| 58 | 60 | $submenu = $menu->addMenu($item['caption']); |
| 59 | 61 | |
| 60 | 62 | self::addItems($submenu, collect($subitems)); |
| 61 | - } |
|
| 62 | - elseif ($subitems = $item['group']?? []) { |
|
| 63 | + } elseif ($subitems = $item['group']?? []) { |
|
| 63 | 64 | $subgroup = $menu->addGroup($item['caption']); |
| 64 | 65 | |
| 65 | 66 | if (($item['toggle']?? false) && !$menu->in_dropdown) { |
@@ -68,8 +69,7 @@ discard block |
||
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | self::addItems($subgroup, collect($subitems)); |
| 71 | - } |
|
| 72 | - elseif ($subitems = $item['accordion']?? []) { |
|
| 72 | + } elseif ($subitems = $item['accordion']?? []) { |
|
| 73 | 73 | $accordion = $menu->add(['Accordion']); |
| 74 | 74 | |
| 75 | 75 | $section = $accordion->addSection($item['caption']); |
@@ -92,12 +92,10 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | // self::addItems($accordion, collect($subitems)); |
| 95 | - } |
|
| 96 | - else { |
|
| 95 | + } else { |
|
| 97 | 96 | if (is_a($menu, Accordion::class)) { |
| 98 | 97 | $menu->add(['View', 'Test']); |
| 99 | - } |
|
| 100 | - else { |
|
| 98 | + } else { |
|
| 101 | 99 | $menu->addItem($item['caption'], $item['link']?? ''); |
| 102 | 100 | } |
| 103 | 101 | |
@@ -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 | // $this->js(true, null, new jsExpression('window'))->on('pageshow', new jsFunction(['event'], [ |
@@ -67,24 +67,24 @@ discard block |
||
| 67 | 67 | // if (event.originalEvent.persisted) { |
| 68 | 68 | // window.location.reload(); |
| 69 | 69 | // }')])); |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - public function setMenu() |
|
| 73 | - { |
|
| 74 | - if ($this->menu) return; |
|
| 72 | + public function setMenu() |
|
| 73 | + { |
|
| 74 | + if ($this->menu) return; |
|
| 75 | 75 | |
| 76 | - //.ui.sidebar, |
|
| 77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
| 76 | + //.ui.sidebar, |
|
| 77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
| 78 | 78 | |
| 79 | - $this->app->addStyle(''); |
|
| 79 | + $this->app->addStyle(''); |
|
| 80 | 80 | |
| 81 | - // company logo |
|
| 82 | - $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
| 81 | + // company logo |
|
| 82 | + $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
| 83 | 83 | |
| 84 | - if ($this->burger) { |
|
| 85 | - /** @scrutinizer ignore-call */ |
|
| 86 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 87 | - } |
|
| 84 | + if ($this->burger) { |
|
| 85 | + /** @scrutinizer ignore-call */ |
|
| 86 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | // home icon |
| 90 | 90 | $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
@@ -126,50 +126,50 @@ discard block |
||
| 126 | 126 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function setMenuLeft() |
|
| 130 | - { |
|
| 131 | - if ($this->menuLeft) return; |
|
| 129 | + public function setMenuLeft() |
|
| 130 | + { |
|
| 131 | + if ($this->menuLeft) return; |
|
| 132 | 132 | |
| 133 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
| 133 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
| 134 | 134 | |
| 135 | - if (! $this->burger) return; |
|
| 135 | + if (! $this->burger) return; |
|
| 136 | 136 | |
| 137 | - if (! session()->get('menu', 1)) { |
|
| 138 | - $this->isMenuLeftVisible = false; |
|
| 139 | - } |
|
| 137 | + if (! session()->get('menu', 1)) { |
|
| 138 | + $this->isMenuLeftVisible = false; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 143 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 144 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 145 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
| 146 | - session()->put('menu', $visible? 1: 0); |
|
| 147 | - session()->save(); |
|
| 148 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 149 | - ]); |
|
| 150 | - } |
|
| 141 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
| 143 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
| 144 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
| 145 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
| 146 | + session()->put('menu', $visible? 1: 0); |
|
| 147 | + session()->save(); |
|
| 148 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 149 | + ]); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - public function setActionBar() |
|
| 153 | - { |
|
| 154 | - if ($this->actionBar) return; |
|
| 152 | + public function setActionBar() |
|
| 153 | + { |
|
| 154 | + if ($this->actionBar) return; |
|
| 155 | 155 | |
| 156 | - $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
| 157 | - } |
|
| 156 | + $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - public function setVersion() |
|
| 160 | - { |
|
| 161 | - $this->template->trySet('version', $this->app->version); |
|
| 162 | - } |
|
| 159 | + public function setVersion() |
|
| 160 | + { |
|
| 161 | + $this->template->trySet('version', $this->app->version); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * {@inheritdoc} |
|
| 166 | - */ |
|
| 164 | + /** |
|
| 165 | + * {@inheritdoc} |
|
| 166 | + */ |
|
| 167 | 167 | |
| 168 | - public function renderView() |
|
| 169 | - { |
|
| 170 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 171 | - $this->menuLeft->addClass('visible'); |
|
| 172 | - } |
|
| 173 | - parent::renderView(); |
|
| 174 | - } |
|
| 168 | + public function renderView() |
|
| 169 | + { |
|
| 170 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
| 171 | + $this->menuLeft->addClass('visible'); |
|
| 172 | + } |
|
| 173 | + parent::renderView(); |
|
| 174 | + } |
|
| 175 | 175 | } |
@@ -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. |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // home icon |
| 90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->add(['Icon', 'home']); |
|
| 90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('view/dashboard'))->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) |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
| 134 | 134 | |
| 135 | - if (! $this->burger) return; |
|
| 135 | + if (!$this->burger) return; |
|
| 136 | 136 | |
| 137 | - if (! session()->get('menu', 1)) { |
|
| 137 | + if (!session()->get('menu', 1)) { |
|
| 138 | 138 | $this->isMenuLeftVisible = false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 141 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
| 142 | 142 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
| 143 | 143 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
| 144 | 144 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
| 145 | 145 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
| 146 | - session()->put('menu', $visible? 1: 0); |
|
| 146 | + session()->put('menu', $visible ? 1 : 0); |
|
| 147 | 147 | session()->save(); |
| 148 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
| 148 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
| 149 | 149 | ]); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -71,7 +71,9 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function setMenu() |
| 73 | 73 | { |
| 74 | - if ($this->menu) return; |
|
| 74 | + if ($this->menu) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | //.ui.sidebar, |
| 77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
@@ -119,7 +121,9 @@ discard block |
||
| 119 | 121 | |
| 120 | 122 | public function setMenuRight() |
| 121 | 123 | { |
| 122 | - if ($this->menuRight) return; |
|
| 124 | + if ($this->menuRight) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 123 | 127 | |
| 124 | 128 | $this->menuRight = $this->menu->add(new Seeds\RightMenu([ |
| 125 | 129 | 'ui' => false |
@@ -128,11 +132,15 @@ discard block |
||
| 128 | 132 | |
| 129 | 133 | public function setMenuLeft() |
| 130 | 134 | { |
| 131 | - if ($this->menuLeft) return; |
|
| 135 | + if ($this->menuLeft) { |
|
| 136 | + return; |
|
| 137 | + } |
|
| 132 | 138 | |
| 133 | 139 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
| 134 | 140 | |
| 135 | - if (! $this->burger) return; |
|
| 141 | + if (! $this->burger) { |
|
| 142 | + return; |
|
| 143 | + } |
|
| 136 | 144 | |
| 137 | 145 | if (! session()->get('menu', 1)) { |
| 138 | 146 | $this->isMenuLeftVisible = false; |
@@ -151,7 +159,9 @@ discard block |
||
| 151 | 159 | |
| 152 | 160 | public function setActionBar() |
| 153 | 161 | { |
| 154 | - if ($this->actionBar) return; |
|
| 162 | + if ($this->actionBar) { |
|
| 163 | + return; |
|
| 164 | + } |
|
| 155 | 165 | |
| 156 | 166 | $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
| 157 | 167 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected $validationRules = []; |
| 18 | 18 | |
| 19 | 19 | public function addElements($elements, $parent = null) { |
| 20 | - $parent = $parent?: $this; |
|
| 20 | + $parent = $parent ?: $this; |
|
| 21 | 21 | |
| 22 | 22 | foreach ($elements as $name => $desc) { |
| 23 | 23 | $name = $desc['name']?? $name; |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | switch ($desc['type']?? 'field') { |
| 28 | 28 | case 'field': |
| 29 | - $desc = is_string($desc)? [ |
|
| 29 | + $desc = is_string($desc) ? [ |
|
| 30 | 30 | 'decorator' => [$desc] |
| 31 | - ]: $desc; |
|
| 31 | + ] : $desc; |
|
| 32 | 32 | |
| 33 | 33 | $field = $parent->addField($name, $desc['decorator']?? [], $desc['options']?? []); |
| 34 | 34 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function addFieldsDisplayRules($fieldsDisplayRules) { |
| 80 | - $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules?: [], $fieldsDisplayRules)); |
|
| 80 | + $this->setFieldsDisplayRules(array_merge($this->fieldsDisplayRules ?: [], $fieldsDisplayRules)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function addGroupDisplayRules($groupDisplayRules) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function addFieldRules($field, $rules = []) { |
| 92 | - if (! $rules) return; |
|
| 92 | + if (!$rules) return; |
|
| 93 | 93 | |
| 94 | 94 | $this->fieldRules[$field] = $rules['rules']?? [ |
| 95 | 95 | 'identifier' => $field, |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function setValues($values) |
| 103 | 103 | { |
| 104 | - foreach ($values?: [] as $name => $value) { |
|
| 105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
| 104 | + foreach ($values ?: [] as $name => $value) { |
|
| 105 | + if (!$field = $this->fields[$name]?? null) continue; |
|
| 106 | 106 | |
| 107 | 107 | $field->set($value); |
| 108 | 108 | } |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | 'fields' => $this->fieldRules |
| 126 | 126 | ]); |
| 127 | 127 | |
| 128 | - $this->onSubmit(function ($form) use ($callback) { |
|
| 128 | + $this->onSubmit(function($form) use ($callback) { |
|
| 129 | 129 | $errors = []; |
| 130 | - foreach ($this->validationRules?: [] as $ruleCallback) { |
|
| 131 | - if (! is_callable($ruleCallback)) continue; |
|
| 130 | + foreach ($this->validationRules ?: [] as $ruleCallback) { |
|
| 131 | + if (!is_callable($ruleCallback)) continue; |
|
| 132 | 132 | |
| 133 | 133 | $ruleErrors = $ruleCallback($form); |
| 134 | 134 | |
| 135 | - $errors = array_merge($errors, $ruleErrors?: []); |
|
| 135 | + $errors = array_merge($errors, $ruleErrors ?: []); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return $errors?: $callback($this); |
|
| 138 | + return $errors ?: $callback($this); |
|
| 139 | 139 | }); |
| 140 | 140 | |
| 141 | 141 | return $this; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | public function confirmLeave($confirm = true) |
| 150 | 150 | { |
| 151 | - $this->canLeave = ! $confirm; |
|
| 151 | + $this->canLeave = !$confirm; |
|
| 152 | 152 | |
| 153 | 153 | return $this; |
| 154 | 154 | } |
@@ -89,7 +89,9 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function addFieldRules($field, $rules = []) { |
| 92 | - if (! $rules) return; |
|
| 92 | + if (! $rules) { |
|
| 93 | + return; |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | $this->fieldRules[$field] = $rules['rules']?? [ |
| 95 | 97 | 'identifier' => $field, |
@@ -102,7 +104,9 @@ discard block |
||
| 102 | 104 | public function setValues($values) |
| 103 | 105 | { |
| 104 | 106 | foreach ($values?: [] as $name => $value) { |
| 105 | - if (! $field = $this->fields[$name]?? null) continue; |
|
| 107 | + if (! $field = $this->fields[$name]?? null) { |
|
| 108 | + continue; |
|
| 109 | + } |
|
| 106 | 110 | |
| 107 | 111 | $field->set($value); |
| 108 | 112 | } |
@@ -128,7 +132,9 @@ discard block |
||
| 128 | 132 | $this->onSubmit(function ($form) use ($callback) { |
| 129 | 133 | $errors = []; |
| 130 | 134 | foreach ($this->validationRules?: [] as $ruleCallback) { |
| 131 | - if (! is_callable($ruleCallback)) continue; |
|
| 135 | + if (! is_callable($ruleCallback)) { |
|
| 136 | + continue; |
|
| 137 | + } |
|
| 132 | 138 | |
| 133 | 139 | $ruleErrors = $ruleCallback($form); |
| 134 | 140 | |