@@ -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 | } |
@@ -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 |
@@ -17,52 +17,52 @@ 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 | - $name = $desc['name']?? $name; |
|
23 | + $name = $desc['name'] ?? $name; |
|
24 | 24 | |
25 | - $this->addFieldRules($name, $desc['rules']?? []); |
|
25 | + $this->addFieldRules($name, $desc['rules'] ?? []); |
|
26 | 26 | |
27 | - switch ($desc['type']?? 'field') { |
|
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 | - $field = $parent->addField($name, $desc['decorator']?? [], $desc['options']?? []); |
|
33 | + $field = $parent->addField($name, $desc['decorator'] ?? [], $desc['options'] ?? []); |
|
34 | 34 | |
35 | 35 | if ($default = $desc['default']) { |
36 | 36 | $field->set($default); |
37 | 37 | } |
38 | 38 | |
39 | - if ($desc['display']?? false) { |
|
39 | + if ($desc['display'] ?? false) { |
|
40 | 40 | $this->addFieldsDisplayRules([$name => $desc['display']]); |
41 | 41 | } |
42 | 42 | break; |
43 | 43 | |
44 | 44 | case 'group': |
45 | - $seed = $desc['seed']?? [$name]; |
|
45 | + $seed = $desc['seed'] ?? [$name]; |
|
46 | 46 | |
47 | 47 | $group = $parent->addGroup($seed); |
48 | 48 | |
49 | 49 | $this->addElements($desc['elements'], $group); |
50 | 50 | |
51 | - if ($desc['display']?? false) { |
|
51 | + if ($desc['display'] ?? false) { |
|
52 | 52 | $this->addGroupDisplayRules([$name => $desc['display']]); |
53 | 53 | } |
54 | 54 | break; |
55 | 55 | |
56 | 56 | case 'header': |
57 | - $seed = $desc['seed']?? [$name]; |
|
57 | + $seed = $desc['seed'] ?? [$name]; |
|
58 | 58 | |
59 | 59 | $parent->addHeader($seed); |
60 | 60 | break; |
61 | 61 | |
62 | 62 | case 'view': |
63 | - $seed = $desc['seed']?? ['Label', $name]; |
|
63 | + $seed = $desc['seed'] ?? ['Label', $name]; |
|
64 | 64 | |
65 | - $region = $desc['region']?? null; |
|
65 | + $region = $desc['region'] ?? null; |
|
66 | 66 | |
67 | 67 | $this->add($seed, $region); |
68 | 68 | break; |
@@ -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,9 +89,9 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | public function addFieldRules($field, $rules = []) { |
92 | - if (! $rules) return; |
|
92 | + if (!$rules) return; |
|
93 | 93 | |
94 | - $this->fieldRules[$field] = $rules['rules']?? [ |
|
94 | + $this->fieldRules[$field] = $rules['rules'] ?? [ |
|
95 | 95 | 'identifier' => $field, |
96 | 96 | 'rules' => $rules |
97 | 97 | ]; |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -41,6 +41,6 @@ |
||
41 | 41 | */ |
42 | 42 | public static function pluck($value, $key = null) |
43 | 43 | { |
44 | - return collect(self::create()->export())->pluck($value, $key); |
|
44 | + return collect(self::create()->export())->pluck($value, $key); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -32,53 +32,53 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class LayoutView extends 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 | - public function init(): void |
|
70 | - { |
|
71 | - parent::init(); |
|
69 | + public 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,25 +87,25 @@ 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 = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
96 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
97 | 97 | |
98 | - // company logo |
|
99 | - // see \Epesi\Core\Controller::logo |
|
100 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
98 | + // company logo |
|
99 | + // see \Epesi\Core\Controller::logo |
|
100 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', 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(['Icon', 'home']); |
|
108 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
109 | 109 | |
110 | 110 | // location bar |
111 | 111 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -148,49 +148,49 @@ discard block |
||
148 | 148 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
149 | 149 | } |
150 | 150 | |
151 | - public function setMenuLeft() |
|
152 | - { |
|
153 | - if ($this->menuLeft) return; |
|
151 | + public function setMenuLeft() |
|
152 | + { |
|
153 | + if ($this->menuLeft) return; |
|
154 | 154 | |
155 | - $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
155 | + $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
|
156 | 156 | |
157 | - if (! $this->burger) return; |
|
157 | + if (! $this->burger) return; |
|
158 | 158 | |
159 | - $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
159 | + $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
|
160 | 160 | |
161 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
163 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
164 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
165 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
166 | - $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
167 | - }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
168 | - ]); |
|
169 | - } |
|
161 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
163 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
164 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
165 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
166 | + $this->memorize('menu', filter_var($visible, FILTER_VALIDATE_BOOLEAN)); |
|
167 | + }, [$this->menuLeft->js(true)->hasClass('visible')]) |
|
168 | + ]); |
|
169 | + } |
|
170 | 170 | |
171 | - public function setActionBar() |
|
172 | - { |
|
173 | - if ($this->actionBar) return; |
|
171 | + public function setActionBar() |
|
172 | + { |
|
173 | + if ($this->actionBar) return; |
|
174 | 174 | |
175 | - $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
175 | + $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
|
176 | 176 | |
177 | - return $this; |
|
178 | - } |
|
177 | + return $this; |
|
178 | + } |
|
179 | 179 | |
180 | - public function setVersion() |
|
181 | - { |
|
182 | - $this->template->trySet('version', $this->app->version); |
|
183 | - } |
|
180 | + public function setVersion() |
|
181 | + { |
|
182 | + $this->template->trySet('version', $this->app->version); |
|
183 | + } |
|
184 | 184 | |
185 | - /** |
|
186 | - * {@inheritdoc} |
|
187 | - */ |
|
185 | + /** |
|
186 | + * {@inheritdoc} |
|
187 | + */ |
|
188 | 188 | |
189 | - public function renderView() |
|
190 | - { |
|
191 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
192 | - $this->menuLeft->addClass('visible'); |
|
193 | - } |
|
194 | - parent::renderView(); |
|
195 | - } |
|
189 | + public function renderView() |
|
190 | + { |
|
191 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
192 | + $this->menuLeft->addClass('visible'); |
|
193 | + } |
|
194 | + parent::renderView(); |
|
195 | + } |
|
196 | 196 | } |
@@ -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. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
109 | 109 | |
110 | 110 | // location bar |
111 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
111 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function setLocation($crumbs) |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | $title = []; |
121 | 121 | foreach ($crumbs as $level) { |
122 | - $label = $level['label']?? $level; |
|
123 | - $link = $level['link']?? null; |
|
122 | + $label = $level['label'] ?? $level; |
|
123 | + $link = $level['link'] ?? null; |
|
124 | 124 | |
125 | 125 | $crumb->addCrumb($label, $link); |
126 | 126 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | |
155 | 155 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
156 | 156 | |
157 | - if (! $this->burger) return; |
|
157 | + if (!$this->burger) return; |
|
158 | 158 | |
159 | 159 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
160 | 160 | |
161 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
161 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
162 | 162 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
163 | 163 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
164 | 164 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
@@ -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 = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
97 | 99 | |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | |
142 | 144 | public function setMenuRight() |
143 | 145 | { |
144 | - if ($this->menuRight) return; |
|
146 | + if ($this->menuRight) { |
|
147 | + return; |
|
148 | + } |
|
145 | 149 | |
146 | 150 | $this->menuRight = $this->menu->add(new View\RightMenu([ |
147 | 151 | 'ui' => false |
@@ -150,11 +154,15 @@ discard block |
||
150 | 154 | |
151 | 155 | public function setMenuLeft() |
152 | 156 | { |
153 | - if ($this->menuLeft) return; |
|
157 | + if ($this->menuLeft) { |
|
158 | + return; |
|
159 | + } |
|
154 | 160 | |
155 | 161 | $this->menuLeft = View\NavMenu::addTo($this, 'left vertical labeled sidebar', ['LeftMenu']); |
156 | 162 | |
157 | - if (! $this->burger) return; |
|
163 | + if (! $this->burger) { |
|
164 | + return; |
|
165 | + } |
|
158 | 166 | |
159 | 167 | $this->isMenuLeftVisible = $this->learn('menu', $this->isMenuLeftVisible); |
160 | 168 | |
@@ -170,7 +178,9 @@ discard block |
||
170 | 178 | |
171 | 179 | public function setActionBar() |
172 | 180 | { |
173 | - if ($this->actionBar) return; |
|
181 | + if ($this->actionBar) { |
|
182 | + return; |
|
183 | + } |
|
174 | 184 | |
175 | 185 | $this->actionBar = View\ActionBar::addTo($this, [], ['ActionBar']); |
176 | 186 |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | class Module extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | - public $table = 'modules'; |
|
12 | + public $table = 'modules'; |
|
13 | 13 | |
14 | - function init(): void |
|
15 | - { |
|
16 | - parent::init(); |
|
14 | + function init(): void |
|
15 | + { |
|
16 | + parent::init(); |
|
17 | 17 | |
18 | - $this->addFields([ |
|
19 | - 'class', |
|
20 | - 'alias', |
|
21 | - 'priority' => ['default' => 0], |
|
22 | - 'state' => ['default' => 1] |
|
23 | - ]); |
|
24 | - } |
|
18 | + $this->addFields([ |
|
19 | + 'class', |
|
20 | + 'alias', |
|
21 | + 'priority' => ['default' => 0], |
|
22 | + 'state' => ['default' => 1] |
|
23 | + ]); |
|
24 | + } |
|
25 | 25 | } |