@@ -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) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function body() |
27 | 27 | { |
28 | - if (! $this->isSingleDashboard()) { |
|
28 | + if (!$this->isSingleDashboard()) { |
|
29 | 29 | $this->location($this->dashboard()['name']); |
30 | 30 | } |
31 | 31 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $applets = $dashboard->ref('applets')->setOrder(['column', 'row']); |
47 | 47 | |
48 | - $columns = $this->add(['Columns', 'id' => 'dashboard', 'ui' => 'three stackable grid' . ($this->isLocked()? ' locked': '')]); |
|
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 | 51 | $columnApplets = clone $applets; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - if (! $this->isLocked()) { |
|
74 | + if (!$this->isLocked()) { |
|
75 | 75 | $columns->js(true)->find('.sortable')->sortable([ |
76 | 76 | 'cursor' => 'move', |
77 | 77 | 'handle' => '.panel-sortable-handle', |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ]) |
90 | 90 | ])); |
91 | 91 | |
92 | - $columns->js(true)->find('.applet-close')->click(new jsFunction(['e'], [new jsExpression('if (confirm("' . __('Delete this applet?') . '")) {$(e.target).closest(".applet").fadeOut(400, function(){var col = $(this).closest(".column.sortable");this.remove();col.trigger("sortupdate");})}')])); |
|
92 | + $columns->js(true)->find('.applet-close')->click(new jsFunction(['e'], [new jsExpression('if (confirm("' . __('Delete this applet?') . '")) {$(e.target).closest(".applet").fadeOut(400, function(){var col = $(this).closest(".column.sortable");this.remove();col.trigger("sortupdate");})}')])); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->columns = $columns; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ] |
137 | 137 | ]); |
138 | 138 | |
139 | - foreach ( AppletJoint::collect() as $applet ) { |
|
139 | + foreach (AppletJoint::collect() as $applet) { |
|
140 | 140 | $col->add([ |
141 | 141 | new Applet(), |
142 | 142 | 'appletId' => 'new_' . str_ireplace('\\', '-', get_class($applet)), |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | |
261 | 261 | $name = $dashboard['name']; |
262 | 262 | |
263 | - return $dashboard->delete()? [ |
|
263 | + return $dashboard->delete() ? [ |
|
264 | 264 | $this->notifySuccess(__('Dashboard ":name" deleted, redirecting ...', compact('name'))), |
265 | 265 | new jsExpression('window.setTimeout(function() {window.location.replace([])}, 1200)', [$this->selfLink()]) |
266 | - ]: $this->notifyError(__('Error deleting dashboard')); |
|
266 | + ] : $this->notifyError(__('Error deleting dashboard')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | public function reorderDashboards($view) |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | $grid->setModel($this->userDashboards()->setOrder('position')); |
274 | 274 | |
275 | - $grid->addDragHandler()->onReorder(function ($order) use ($grid) { |
|
275 | + $grid->addDragHandler()->onReorder(function($order) use ($grid) { |
|
276 | 276 | foreach ($this->userDashboards() as $dashboard) { |
277 | 277 | $dashboard->save(['position' => array_search($dashboard->id, $order)]); |
278 | 278 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | public function isLocked() |
356 | 356 | { |
357 | - return $this->locked || ! Auth::user()->can('edit dashboard'); |
|
357 | + return $this->locked || !Auth::user()->can('edit dashboard'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | protected function isSingleDashboard() |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | */ |
371 | 371 | protected function dashboard() |
372 | 372 | { |
373 | - if (! is_object($this->dashboard)) { |
|
374 | - $this->dashboard = $this->dashboard? Dashboard::create()->tryLoad($this->dashboard): $this->defaultUserDashboard(); |
|
373 | + if (!is_object($this->dashboard)) { |
|
374 | + $this->dashboard = $this->dashboard ? Dashboard::create()->tryLoad($this->dashboard) : $this->defaultUserDashboard(); |
|
375 | 375 | } |
376 | 376 | |
377 | - return $this->dashboard?: abort(404); |
|
377 | + return $this->dashboard ?: abort(404); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | protected function defaultUserDashboard() |
381 | 381 | { |
382 | 382 | $userDashboard = $this->userDashboards()->setOrder('position')->tryLoadAny(); |
383 | 383 | |
384 | - if (! $userDashboard->loaded()) { |
|
384 | + if (!$userDashboard->loaded()) { |
|
385 | 385 | $this->lock(); |
386 | 386 | |
387 | 387 | $userDashboard = $this->defaultSystemDashboard(); |
@@ -405,6 +405,6 @@ discard block |
||
405 | 405 | */ |
406 | 406 | protected function userId() |
407 | 407 | { |
408 | - return $this->admin? 0: Auth::id(); |
|
408 | + return $this->admin ? 0 : Auth::id(); |
|
409 | 409 | } |
410 | 410 | } |