@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $columns = $this->add(['Columns', 'id' => 'dashboard', 'ui' => 'three stackable grid' . ($this->isLocked()? ' locked': '')]); |
49 | 49 | |
50 | 50 | foreach ([1, 2, 3] as $columnId) { |
51 | - $columnApplets = clone $applets; |
|
51 | + $columnApplets = clone $applets; |
|
52 | 52 | |
53 | 53 | /** @scrutinizer ignore-call */ |
54 | 54 | $col = $columns->addColumn([ |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | $existingList = collect($existing->export())->pluck('name', 'id'); |
206 | 206 | |
207 | 207 | $form->addFields([ |
208 | - ['name', __('Name')], |
|
209 | - ['base', ['DropDown', 'caption' => __('Copy applets from'), 'values' => $existingList]] |
|
210 | - ]); |
|
208 | + ['name', __('Name')], |
|
209 | + ['base', ['DropDown', 'caption' => __('Copy applets from'), 'values' => $existingList]] |
|
210 | + ]); |
|
211 | 211 | |
212 | 212 | $form->layout->addButton(['Button', __('Cancel')])->on('click', $view->owner->hide()); |
213 | 213 | |
@@ -219,19 +219,19 @@ discard block |
||
219 | 219 | $dashboardId = (int) $dashboard->insert([ |
220 | 220 | 'name' => $values['name'], |
221 | 221 | 'user_id' => $this->userId(), |
222 | - 'position' => count($existingList) |
|
222 | + 'position' => count($existingList) |
|
223 | 223 | ]); |
224 | 224 | |
225 | 225 | if ($values['base']) { |
226 | - foreach ($dashboard->withID($values['base'])->ref('applets') as $baseApplet) { |
|
227 | - // only save on below does not work for some reason. fails when reloading |
|
228 | - $baseApplet->duplicate()->saveAndUnload(['dashboard_id' => $dashboardId]); |
|
226 | + foreach ($dashboard->withID($values['base'])->ref('applets') as $baseApplet) { |
|
227 | + // only save on below does not work for some reason. fails when reloading |
|
228 | + $baseApplet->duplicate()->saveAndUnload(['dashboard_id' => $dashboardId]); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | return [ |
233 | 233 | $form->notify(__('Dashboard created, redirecting ...')), |
234 | - new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink('body', ['dashboard' => $dashboardId])]) |
|
234 | + new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink('body', ['dashboard' => $dashboardId])]) |
|
235 | 235 | ]; |
236 | 236 | }); |
237 | 237 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | return [ |
251 | 251 | $form->notifySuccess(__('Dashboard renamed, reloading ...')), |
252 | - new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink('body', ['dashboard' => $this->dashboard()->id])]) |
|
252 | + new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink('body', ['dashboard' => $this->dashboard()->id])]) |
|
253 | 253 | ]; |
254 | 254 | }); |
255 | 255 | } |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $name = $dashboard['name']; |
262 | 262 | |
263 | 263 | return $dashboard->delete()? [ |
264 | - $this->notifySuccess(__('Dashboard ":name" deleted, redirecting ...', compact('name'))), |
|
265 | - new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink()]) |
|
264 | + $this->notifySuccess(__('Dashboard ":name" deleted, redirecting ...', compact('name'))), |
|
265 | + new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink()]) |
|
266 | 266 | ]: $this->notifyError(__('Error deleting dashboard')); |
267 | 267 | } |
268 | 268 | |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | $grid->setModel($this->userDashboards()->setOrder('position')); |
274 | 274 | |
275 | 275 | $grid->addDragHandler()->onReorder(function ($order) use ($grid) { |
276 | - foreach ($this->userDashboards() as $dashboard) { |
|
276 | + foreach ($this->userDashboards() as $dashboard) { |
|
277 | 277 | $dashboard->save(['position' => array_search($dashboard->id, $order)]); |
278 | 278 | } |
279 | 279 | |
280 | - return [ |
|
281 | - new jsReload($grid), |
|
282 | - $this->notifySuccess(__('Dashboards reordered!')) |
|
283 | - ]; |
|
280 | + return [ |
|
281 | + new jsReload($grid), |
|
282 | + $this->notifySuccess(__('Dashboards reordered!')) |
|
283 | + ]; |
|
284 | 284 | }); |
285 | 285 | |
286 | 286 | $view->add(['View', 'ui' => 'buttons'])->add(['Button', __('Done'), 'primary'])->on('click', new jsExpression('location.reload()')); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $form->model->set($applet['options']); |
336 | 336 | |
337 | 337 | $form->validate(function(Form $form) use ($applet) { |
338 | - $applet->save(['options' => $form->model->get()]); |
|
338 | + $applet->save(['options' => $form->model->get()]); |
|
339 | 339 | |
340 | 340 | return $form->notifySuccess(__('Settings saved!')); |
341 | 341 | }); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | protected function defaultSystemDashboard() |
394 | 394 | { |
395 | - return $this->userDashboards(0)->setOrder('position')->tryLoadAny(); |
|
395 | + return $this->userDashboards(0)->setOrder('position')->tryLoadAny(); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | protected function userDashboards($userId = null) |