@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | ActionBar::addButton('back')->link(url('view/system')); |
32 | 32 | |
33 | - $this->parentId = $this->stickyGet('parentId')?: null; |
|
33 | + $this->parentId = $this->stickyGet('parentId') ?: null; |
|
34 | 34 | |
35 | 35 | $this->displayBreadCrumb(); |
36 | 36 | |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | $this->grid->setModel($model = $this->getModel()); |
77 | 77 | |
78 | - if ($model->action('count')->getOne() ) { |
|
78 | + if ($model->action('count')->getOne()) { |
|
79 | 79 | $this->grid->table->onRowClick(new jsExpression( |
80 | 80 | 'document.location=\'?parentId=\'+[]', |
81 | 81 | [(new jQuery())->data('id')] |
82 | 82 | )); |
83 | 83 | } |
84 | 84 | |
85 | - $this->grid->addDragHandler()->onReorder(function ($order) { |
|
85 | + $this->grid->addDragHandler()->onReorder(function($order) { |
|
86 | 86 | $result = true; |
87 | 87 | foreach ($this->nodes()->get() as $node) { |
88 | 88 | $node->position = array_search($node->id, $order); |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $result &= $node->save(); |
91 | 91 | } |
92 | 92 | |
93 | - $notifier = $result? $this->notify(__('Items reordered!')): $this->notifyError(__('Error saving order!')); |
|
93 | + $notifier = $result ? $this->notify(__('Items reordered!')) : $this->notifyError(__('Error saving order!')); |
|
94 | 94 | |
95 | 95 | return $this->grid->jsSave($notifier); |
96 | 96 | }); |
97 | 97 | |
98 | 98 | $this->addContolButton('update', $this->getUpdateModal(), 'edit'); |
99 | 99 | |
100 | - $this->addContolButton('delete', function ($jschain, $id) { |
|
100 | + $this->addContolButton('delete', function($jschain, $id) { |
|
101 | 101 | CommonData::find($id)->delete(); |
102 | 102 | |
103 | 103 | return $jschain->closest('tr')->transition('fade left'); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $ret .= $button->getHtml(); |
120 | 120 | } |
121 | 121 | |
122 | - return $ret;; |
|
122 | + return $ret; ; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | public function getUpdateModal() |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $grid->pageUpdate = $grid->add($grid->pageUpdate ?: $grid->pageDefault, ['short_name'=>'edit']); |
130 | 130 | |
131 | - $modal = new jsModal(__('Edit'), $grid->pageUpdate, [$grid->name => $grid->jsRow()->data('id'), $grid->name.'_sort' => $grid->getSortBy()]); |
|
131 | + $modal = new jsModal(__('Edit'), $grid->pageUpdate, [$grid->name => $grid->jsRow()->data('id'), $grid->name . '_sort' => $grid->getSortBy()]); |
|
132 | 132 | |
133 | - $grid->pageUpdate->set(function () { |
|
133 | + $grid->pageUpdate->set(function() { |
|
134 | 134 | $grid = $this->grid; |
135 | 135 | |
136 | 136 | $grid->model->load($grid->app->stickyGet($grid->name)); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // set save handler with reload trigger |
150 | 150 | // adds default submit hook if it is not already set for this form |
151 | 151 | if (!$grid->formUpdate->hookHasCallbacks('submit')) { |
152 | - $grid->formUpdate->onSubmit(function ($form) { |
|
152 | + $grid->formUpdate->onSubmit(function($form) { |
|
153 | 153 | $form->model->save(); |
154 | 154 | |
155 | 155 | return $this->grid->jsSaveUpdate(); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $this->grid->on('click', ".$class", $callback, [$this->grid->table->jsRow()->data('id')]); |
168 | 168 | |
169 | - $this->buttons[$name] = new \atk4\ui\Button($icon? compact('icon'): $name); |
|
169 | + $this->buttons[$name] = new \atk4\ui\Button($icon ? compact('icon') : $name); |
|
170 | 170 | |
171 | 171 | $this->buttons[$name]->app = $this->app; |
172 | 172 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | $rowsEmpty = []; |
195 | 195 | |
196 | - $model = new \atk4\data\Model($rows? new \atk4\data\Persistence_Static($rows): new \atk4\data\Persistence_Array($rowsEmpty)); |
|
196 | + $model = new \atk4\data\Model($rows ? new \atk4\data\Persistence_Static($rows) : new \atk4\data\Persistence_Array($rowsEmpty)); |
|
197 | 197 | |
198 | 198 | $captions = [ |
199 | 199 | 'position' => __('Position'), |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | ]; |
204 | 204 | |
205 | 205 | foreach ($captions as $key => $caption) { |
206 | - $field = $rows? $model->hasField($key): $model->addField($key); |
|
206 | + $field = $rows ? $model->hasField($key) : $model->addField($key); |
|
207 | 207 | |
208 | 208 | if ($key === 'readonly') { |
209 | 209 | $field->setDefaults(['ui' => ['visible' => false]]); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | public function getNodeForm() |
221 | 221 | { |
222 | - if (! $this->form) { |
|
222 | + if (!$this->form) { |
|
223 | 223 | $this->form = new Form(['buttonSave' => ['Button', __('Save'), 'primary']]); |
224 | 224 | |
225 | 225 | $this->form->addHook('submit', function($form) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | CommonData::create(array_merge($values, [ |
235 | 235 | 'position' => $this->nodes()->max('position') + 1 |
236 | - ]), $this->parentId? CommonData::find($this->parentId): null); |
|
236 | + ]), $this->parentId ? CommonData::find($this->parentId) : null); |
|
237 | 237 | |
238 | 238 | return $this->grid->jsSaveCreate(); |
239 | 239 | }); |