@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class ActionBar extends Menu |
9 | 9 | { |
10 | - public $ui = 'actionbar menu'; |
|
10 | + public $ui = 'actionbar menu'; |
|
11 | 11 | |
12 | 12 | protected static $buttons = []; |
13 | 13 | |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function renderView() |
49 | - { |
|
50 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
51 | - return $element->weight ?? 10; |
|
52 | - })->toArray(); |
|
49 | + { |
|
50 | + $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
51 | + return $element->weight ?? 10; |
|
52 | + })->toArray(); |
|
53 | 53 | |
54 | - return parent::renderView(); |
|
54 | + return parent::renderView(); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public static function addMenuButton($menu) |
83 | 83 | { |
84 | - return self::instance()->addMenu($menu); |
|
84 | + return self::instance()->addMenu($menu); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public static function clear() |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function renderView() |
49 | 49 | { |
50 | - $this->elements = collect($this->elements)->sortByDesc(function ($element) { |
|
50 | + $this->elements = collect($this->elements)->sortByDesc(function($element) { |
|
51 | 51 | return $element->weight ?? 10; |
52 | 52 | })->toArray(); |
53 | 53 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function addItemButton($button, $defaults = []) |
65 | 65 | { |
66 | - $button = is_string($button)? self::getPredefined($button): $button; |
|
66 | + $button = is_string($button) ? self::getPredefined($button) : $button; |
|
67 | 67 | |
68 | - $button = is_array($button)? new ActionBarItem($button): $button; |
|
68 | + $button = is_array($button) ? new ActionBarItem($button) : $button; |
|
69 | 69 | |
70 | 70 | $actionBar = self::instance(); |
71 | 71 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class NavMenu extends BaseMenu |
10 | 10 | { |
11 | - public $ui = 'inverted nav menu'; |
|
11 | + public $ui = 'inverted nav menu'; |
|
12 | 12 | |
13 | 13 | public function init() |
14 | 14 | { |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | self::addItems($submenu, collect($subitems)); |
59 | 59 | } |
60 | 60 | elseif ($subitems = $entry['group'] ?? []) { |
61 | - $subgroup = $menu->addGroup($entry['item']); |
|
61 | + $subgroup = $menu->addGroup($entry['item']); |
|
62 | 62 | |
63 | 63 | self::addItems($subgroup, collect($subitems)); |
64 | 64 | } |
65 | 65 | else { |
66 | - $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
66 | + $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
67 | 67 | } |
68 | 68 | }); |
69 | 69 | } |
@@ -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($entry, $caption) use ($menu) { |
43 | - if (! ($entry['access'] ?? true)) return; |
|
43 | + if (!($entry['access'] ?? true)) return; |
|
44 | 44 | |
45 | 45 | if (!is_array($entry)) { |
46 | 46 | $entry = ['action' => $entry]; |
@@ -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 | }); |
@@ -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 = $item->add(['View', 'attr' => ['method' => 'POST', 'action' => url('logout')]])->setElement('form')->addStyle(['display' => 'none']); |
67 | 67 | $logoutForm->id = 'logout-form'; |
68 | 68 | $logoutForm->add(['View', '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 | } |
@@ -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 | } |
@@ -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() |
|
17 | - { |
|
18 | - $this->addCallback(); |
|
16 | + public function renderView() |
|
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 = $this->add('jsCallback')->set($callable); |
|
38 | - } |
|
34 | + public function addCallback() |
|
35 | + { |
|
36 | + if (is_callable($callable = $this->callback)) { |
|
37 | + $callable = $this->add('jsCallback')->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 | } |
@@ -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, |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | 'fields' => $this->fieldRules |
110 | 110 | ]); |
111 | 111 | |
112 | - $this->onSubmit(function ($form) use ($callback) { |
|
112 | + $this->onSubmit(function($form) use ($callback) { |
|
113 | 113 | $errors = []; |
114 | - foreach ($this->validationRules?: [] as $ruleCallback) { |
|
115 | - if (! is_callable($ruleCallback)) continue; |
|
114 | + foreach ($this->validationRules ?: [] as $ruleCallback) { |
|
115 | + if (!is_callable($ruleCallback)) continue; |
|
116 | 116 | |
117 | 117 | $ruleErrors = $ruleCallback($form); |
118 | 118 | |
119 | - $errors = array_merge($errors, $ruleErrors?: []); |
|
119 | + $errors = array_merge($errors, $ruleErrors ?: []); |
|
120 | 120 | } |
121 | 121 | |
122 | - return $errors?: $callback($this); |
|
122 | + return $errors ?: $callback($this); |
|
123 | 123 | }); |
124 | 124 | |
125 | 125 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function confirmLeave($confirm = true) |
134 | 134 | { |
135 | - $this->canLeave = ! $confirm; |
|
135 | + $this->canLeave = !$confirm; |
|
136 | 136 | |
137 | 137 | return $this; |
138 | 138 | } |
@@ -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, |
@@ -112,7 +114,9 @@ discard block |
||
112 | 114 | $this->onSubmit(function ($form) use ($callback) { |
113 | 115 | $errors = []; |
114 | 116 | foreach ($this->validationRules?: [] as $ruleCallback) { |
115 | - if (! is_callable($ruleCallback)) continue; |
|
117 | + if (! is_callable($ruleCallback)) { |
|
118 | + continue; |
|
119 | + } |
|
116 | 120 | |
117 | 121 | $ruleErrors = $ruleCallback($form); |
118 | 122 |
@@ -8,79 +8,79 @@ |
||
8 | 8 | |
9 | 9 | class ActionButton extends View |
10 | 10 | { |
11 | - public $defaultTemplate = 'action_button.html'; |
|
11 | + public $defaultTemplate = 'action_button.html'; |
|
12 | 12 | |
13 | - public $ui = 'basic inverted action button'; |
|
13 | + public $ui = 'basic inverted action button'; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Icon that will appear on the button (top). |
|
17 | - * |
|
18 | - * @var string|array|Icon |
|
19 | - */ |
|
20 | - public $icon; |
|
15 | + /** |
|
16 | + * Icon that will appear on the button (top). |
|
17 | + * |
|
18 | + * @var string|array|Icon |
|
19 | + */ |
|
20 | + public $icon; |
|
21 | 21 | |
22 | - public $label; |
|
22 | + public $label; |
|
23 | 23 | |
24 | - public $element = 'a'; |
|
24 | + public $element = 'a'; |
|
25 | 25 | |
26 | - public $weight = 10; |
|
26 | + public $weight = 10; |
|
27 | 27 | |
28 | - public $callback; |
|
28 | + public $callback; |
|
29 | 29 | |
30 | - public function renderView() |
|
31 | - { |
|
32 | - $this->addIcon(); |
|
30 | + public function renderView() |
|
31 | + { |
|
32 | + $this->addIcon(); |
|
33 | 33 | |
34 | - $this->addLabel(); |
|
34 | + $this->addLabel(); |
|
35 | 35 | |
36 | - $this->addCallback(); |
|
36 | + $this->addCallback(); |
|
37 | 37 | |
38 | - parent::renderView(); |
|
39 | - } |
|
38 | + parent::renderView(); |
|
39 | + } |
|
40 | 40 | |
41 | - protected function addIcon() |
|
42 | - { |
|
43 | - if (! $icon = $this->getIcon()) return; |
|
41 | + protected function addIcon() |
|
42 | + { |
|
43 | + if (! $icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | - $this->add($icon, 'Icon')->id = null; |
|
45 | + $this->add($icon, 'Icon')->id = null; |
|
46 | 46 | |
47 | - $this->addClass('icon'); |
|
47 | + $this->addClass('icon'); |
|
48 | 48 | |
49 | - return $this; |
|
50 | - } |
|
49 | + return $this; |
|
50 | + } |
|
51 | 51 | |
52 | - protected function addLabel() |
|
53 | - { |
|
54 | - $this->content = $this->label?: $this->content; |
|
52 | + protected function addLabel() |
|
53 | + { |
|
54 | + $this->content = $this->label?: $this->content; |
|
55 | 55 | |
56 | - return $this; |
|
57 | - } |
|
56 | + return $this; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getIcon() |
|
60 | - { |
|
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | - } |
|
59 | + public function getIcon() |
|
60 | + { |
|
61 | + return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
62 | + } |
|
63 | 63 | |
64 | - public function callback($callable) |
|
65 | - { |
|
66 | - $this->callback = $callable; |
|
64 | + public function callback($callable) |
|
65 | + { |
|
66 | + $this->callback = $callable; |
|
67 | 67 | |
68 | - return $this; |
|
69 | - } |
|
68 | + return $this; |
|
69 | + } |
|
70 | 70 | |
71 | - public function addCallback() |
|
72 | - { |
|
73 | - if (!$callable = $this->callback) return; |
|
71 | + public function addCallback() |
|
72 | + { |
|
73 | + if (!$callable = $this->callback) return; |
|
74 | 74 | |
75 | - if (is_callable($callable)) { |
|
76 | - $callable = $this->add('jsCallback')->set($callable); |
|
77 | - } |
|
75 | + if (is_callable($callable)) { |
|
76 | + $callable = $this->add('jsCallback')->set($callable); |
|
77 | + } |
|
78 | 78 | |
79 | - if ($callable instanceof jsCallback) { |
|
80 | - $this->on('click', $callable); |
|
81 | - } |
|
79 | + if ($callable instanceof jsCallback) { |
|
80 | + $this->on('click', $callable); |
|
81 | + } |
|
82 | 82 | |
83 | - return $this; |
|
84 | - } |
|
83 | + return $this; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (!$icon = $this->getIcon()) return; |
|
44 | 44 | |
45 | 45 | $this->add($icon, 'Icon')->id = null; |
46 | 46 | |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function addLabel() |
53 | 53 | { |
54 | - $this->content = $this->label?: $this->content; |
|
54 | + $this->content = $this->label ?: $this->content; |
|
55 | 55 | |
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | |
59 | 59 | public function getIcon() |
60 | 60 | { |
61 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
61 | + return is_object($this->icon) ? $this->icon : new Icon($this->icon); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function callback($callable) |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function addIcon() |
42 | 42 | { |
43 | - if (! $icon = $this->getIcon()) return; |
|
43 | + if (! $icon = $this->getIcon()) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $this->add($icon, 'Icon')->id = null; |
46 | 48 | |
@@ -70,7 +72,9 @@ discard block |
||
70 | 72 | |
71 | 73 | public function addCallback() |
72 | 74 | { |
73 | - if (!$callable = $this->callback) return; |
|
75 | + if (!$callable = $this->callback) { |
|
76 | + return; |
|
77 | + } |
|
74 | 78 | |
75 | 79 | if (is_callable($callable)) { |
76 | 80 | $callable = $this->add('jsCallback')->set($callable); |
@@ -6,8 +6,8 @@ |
||
6 | 6 | { |
7 | 7 | public $defaultTemplate = 'launch_button.html'; |
8 | 8 | |
9 | - public $ui = 'basic launch pjax button'; |
|
9 | + public $ui = 'basic launch pjax button'; |
|
10 | 10 | |
11 | - public $container = 'View'; |
|
11 | + public $container = 'View'; |
|
12 | 12 | |
13 | 13 | } |
@@ -30,51 +30,51 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - /** |
|
34 | - * @var View\NavMenu |
|
35 | - */ |
|
36 | - public $menuLeft; // vertical menu |
|
33 | + /** |
|
34 | + * @var View\NavMenu |
|
35 | + */ |
|
36 | + public $menuLeft; // vertical menu |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var \atk4\ui\Menu |
|
40 | - */ |
|
41 | - public $menu; // horizontal menu |
|
38 | + /** |
|
39 | + * @var \atk4\ui\Menu |
|
40 | + */ |
|
41 | + public $menu; // horizontal menu |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var \atk4\ui\Menu |
|
45 | - */ |
|
46 | - public $menuRight; // vertical pull-down |
|
43 | + /** |
|
44 | + * @var \atk4\ui\Menu |
|
45 | + */ |
|
46 | + public $menuRight; // vertical pull-down |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var View\ActionBar |
|
50 | - */ |
|
51 | - public $actionBar; |
|
52 | - public $locationBar; |
|
48 | + /** |
|
49 | + * @var View\ActionBar |
|
50 | + */ |
|
51 | + public $actionBar; |
|
52 | + public $locationBar; |
|
53 | 53 | |
54 | - public $burger = true; // burger menu item |
|
54 | + public $burger = true; // burger menu item |
|
55 | 55 | |
56 | - /* |
|
56 | + /* |
|
57 | 57 | * Whether or not left Menu is visible on Page load. |
58 | 58 | */ |
59 | - public $isMenuLeftVisible = true; |
|
59 | + public $isMenuLeftVisible = true; |
|
60 | 60 | |
61 | - public $defaultTemplate = 'layout/admin.html'; |
|
61 | + public $defaultTemplate = 'layout/admin.html'; |
|
62 | 62 | |
63 | - protected $location; |
|
63 | + protected $location; |
|
64 | 64 | |
65 | - public function init() |
|
66 | - { |
|
67 | - parent::init(); |
|
65 | + public function init() |
|
66 | + { |
|
67 | + parent::init(); |
|
68 | 68 | |
69 | - $this->setMenu(); |
|
70 | - $this->setActionBar(); |
|
69 | + $this->setMenu(); |
|
70 | + $this->setActionBar(); |
|
71 | 71 | |
72 | 72 | // if (request()->pjax()) return; |
73 | 73 | |
74 | - $this->setMenuLeft(); |
|
75 | - $this->setMenuRight(); |
|
74 | + $this->setMenuLeft(); |
|
75 | + $this->setMenuRight(); |
|
76 | 76 | |
77 | - $this->setVersion(); |
|
77 | + $this->setVersion(); |
|
78 | 78 | |
79 | 79 | // $this->js(true, null, 'body')->niceScroll(); |
80 | 80 | |
@@ -83,25 +83,25 @@ discard block |
||
83 | 83 | // if (event.originalEvent.persisted) { |
84 | 84 | // window.location.reload(); |
85 | 85 | // }')])); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - public function setMenu() |
|
89 | - { |
|
90 | - if ($this->menu) return; |
|
88 | + public function setMenu() |
|
89 | + { |
|
90 | + if ($this->menu) return; |
|
91 | 91 | |
92 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
92 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
93 | 93 | |
94 | - // company logo |
|
95 | - // see \Epesi\Core\Controller::logo |
|
96 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
94 | + // company logo |
|
95 | + // see \Epesi\Core\Controller::logo |
|
96 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
97 | 97 | |
98 | - if ($this->burger) { |
|
99 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
100 | - } |
|
98 | + if ($this->burger) { |
|
99 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
100 | + } |
|
101 | 101 | |
102 | 102 | // home icon redirects to /home path |
103 | 103 | // see \Epesi\Core\Controller::home |
104 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
104 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
105 | 105 | |
106 | 106 | // location bar |
107 | 107 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -144,52 +144,52 @@ discard block |
||
144 | 144 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
145 | 145 | } |
146 | 146 | |
147 | - public function setMenuLeft() |
|
148 | - { |
|
149 | - if ($this->menuLeft) return; |
|
147 | + public function setMenuLeft() |
|
148 | + { |
|
149 | + if ($this->menuLeft) return; |
|
150 | 150 | |
151 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
151 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
152 | 152 | |
153 | - if (! $this->burger) return; |
|
153 | + if (! $this->burger) return; |
|
154 | 154 | |
155 | - if (! session()->get('menu', 1)) { |
|
156 | - $this->isMenuLeftVisible = false; |
|
157 | - } |
|
155 | + if (! session()->get('menu', 1)) { |
|
156 | + $this->isMenuLeftVisible = false; |
|
157 | + } |
|
158 | 158 | |
159 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
161 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
162 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
163 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
164 | - session()->put('menu', $visible? 1: 0); |
|
165 | - session()->save(); |
|
166 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
167 | - ]); |
|
168 | - } |
|
159 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
161 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
162 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
163 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
164 | + session()->put('menu', $visible? 1: 0); |
|
165 | + session()->save(); |
|
166 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
167 | + ]); |
|
168 | + } |
|
169 | 169 | |
170 | - public function setActionBar() |
|
171 | - { |
|
172 | - if ($this->actionBar) return; |
|
170 | + public function setActionBar() |
|
171 | + { |
|
172 | + if ($this->actionBar) return; |
|
173 | 173 | |
174 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
174 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
175 | 175 | |
176 | - return $this; |
|
177 | - } |
|
176 | + return $this; |
|
177 | + } |
|
178 | 178 | |
179 | - public function setVersion() |
|
180 | - { |
|
181 | - $this->template->trySet('version', $this->app->version); |
|
182 | - } |
|
179 | + public function setVersion() |
|
180 | + { |
|
181 | + $this->template->trySet('version', $this->app->version); |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * {@inheritdoc} |
|
186 | - */ |
|
184 | + /** |
|
185 | + * {@inheritdoc} |
|
186 | + */ |
|
187 | 187 | |
188 | - public function renderView() |
|
189 | - { |
|
190 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
191 | - $this->menuLeft->addClass('visible'); |
|
192 | - } |
|
193 | - parent::renderView(); |
|
194 | - } |
|
188 | + public function renderView() |
|
189 | + { |
|
190 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
191 | + $this->menuLeft->addClass('visible'); |
|
192 | + } |
|
193 | + parent::renderView(); |
|
194 | + } |
|
195 | 195 | } |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var View\NavMenu |
35 | 35 | */ |
36 | - public $menuLeft; // vertical menu |
|
36 | + public $menuLeft; // vertical menu |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @var \atk4\ui\Menu |
40 | 40 | */ |
41 | - public $menu; // horizontal menu |
|
41 | + public $menu; // horizontal menu |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @var \atk4\ui\Menu |
45 | 45 | */ |
46 | - public $menuRight; // vertical pull-down |
|
46 | + public $menuRight; // vertical pull-down |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var View\ActionBar |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public $actionBar; |
52 | 52 | public $locationBar; |
53 | 53 | |
54 | - public $burger = true; // burger menu item |
|
54 | + public $burger = true; // burger menu item |
|
55 | 55 | |
56 | 56 | /* |
57 | 57 | * Whether or not left Menu is visible on Page load. |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
105 | 105 | |
106 | 106 | // location bar |
107 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
107 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function setLocation($crumbs) |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | |
151 | 151 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
152 | 152 | |
153 | - if (! $this->burger) return; |
|
153 | + if (!$this->burger) return; |
|
154 | 154 | |
155 | - if (! session()->get('menu', 1)) { |
|
155 | + if (!session()->get('menu', 1)) { |
|
156 | 156 | $this->isMenuLeftVisible = false; |
157 | 157 | } |
158 | 158 | |
159 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
159 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
160 | 160 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
161 | 161 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
162 | 162 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
163 | 163 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
164 | - session()->put('menu', $visible? 1: 0); |
|
164 | + session()->put('menu', $visible ? 1 : 0); |
|
165 | 165 | session()->save(); |
166 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
166 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
167 | 167 | ]); |
168 | 168 | } |
169 | 169 |
@@ -87,7 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | public function setMenu() |
89 | 89 | { |
90 | - if ($this->menu) return; |
|
90 | + if ($this->menu) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | |
92 | 94 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
93 | 95 | |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | |
138 | 140 | public function setMenuRight() |
139 | 141 | { |
140 | - if ($this->menuRight) return; |
|
142 | + if ($this->menuRight) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
143 | 147 | 'ui' => false |
@@ -146,11 +150,15 @@ discard block |
||
146 | 150 | |
147 | 151 | public function setMenuLeft() |
148 | 152 | { |
149 | - if ($this->menuLeft) return; |
|
153 | + if ($this->menuLeft) { |
|
154 | + return; |
|
155 | + } |
|
150 | 156 | |
151 | 157 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
152 | 158 | |
153 | - if (! $this->burger) return; |
|
159 | + if (! $this->burger) { |
|
160 | + return; |
|
161 | + } |
|
154 | 162 | |
155 | 163 | if (! session()->get('menu', 1)) { |
156 | 164 | $this->isMenuLeftVisible = false; |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | public function setActionBar() |
171 | 179 | { |
172 | - if ($this->actionBar) return; |
|
180 | + if ($this->actionBar) { |
|
181 | + return; |
|
182 | + } |
|
173 | 183 | |
174 | 184 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
175 | 185 |
@@ -7,22 +7,22 @@ |
||
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 | - * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | - * |
|
15 | - * @return \atk4\data\Persistence_SQL |
|
16 | - * @throws \atk4\data\Exception |
|
17 | - * @throws \atk4\dsql\Exception |
|
18 | - */ |
|
19 | - public function __construct(DatabaseManager $database) |
|
20 | - { |
|
21 | - $pdo = $database->connection()->getPdo(); |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @param \Illuminate\Database\DatabaseManager $db The Laravel database manager |
|
14 | + * |
|
15 | + * @return \atk4\data\Persistence_SQL |
|
16 | + * @throws \atk4\data\Exception |
|
17 | + * @throws \atk4\dsql\Exception |
|
18 | + */ |
|
19 | + public function __construct(DatabaseManager $database) |
|
20 | + { |
|
21 | + $pdo = $database->connection()->getPdo(); |
|
22 | 22 | |
23 | - // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
24 | - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
23 | + // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
24 | + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
25 | 25 | |
26 | - parent::__construct(Connection::connect($pdo)); |
|
27 | - } |
|
26 | + parent::__construct(Connection::connect($pdo)); |
|
27 | + } |
|
28 | 28 | } |