@@ -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 | } |
@@ -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 (!isset($entry['action']) && !is_array($entry)) { |
| 46 | 46 | $entry = ['action' => $entry]; |
@@ -40,7 +40,9 @@ discard block |
||
| 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)) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | if (!isset($entry['action']) && !is_array($entry)) { |
| 46 | 48 | $entry = ['action' => $entry]; |
@@ -56,13 +58,11 @@ discard block |
||
| 56 | 58 | $submenu = $menu->addMenu($entry['item']); |
| 57 | 59 | |
| 58 | 60 | self::addItems($submenu, collect($subitems)); |
| 59 | - } |
|
| 60 | - elseif ($subitems = $entry['group'] ?? []) { |
|
| 61 | + } elseif ($subitems = $entry['group'] ?? []) { |
|
| 61 | 62 | $subgroup = $menu->addGroup($entry['item']); |
| 62 | 63 | |
| 63 | 64 | self::addItems($subgroup, collect($subitems)); |
| 64 | - } |
|
| 65 | - else { |
|
| 65 | + } else { |
|
| 66 | 66 | $menu->addItem($entry['item'], $entry['action'] ?? ''); |
| 67 | 67 | } |
| 68 | 68 | }); |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | parent::__construct([ |
| 30 | 30 | 'title' => config('epesi.app.title', 'EPESI'), |
| 31 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.app.cdn')), |
|
| 31 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.app.cdn')), |
|
| 32 | 32 | //TODO: set the skin from admin / user selection |
| 33 | - 'skin' => config('epesi.app.skin', $this->skin), |
|
| 34 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir) |
|
| 33 | + 'skin' => config('epesi.app.skin', $this->skin), |
|
| 34 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir) |
|
| 35 | 35 | ]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -73,43 +73,43 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function renderException($exception) |
| 75 | 75 | { |
| 76 | - ob_start(); |
|
| 77 | - if ($exception instanceof TokenMismatchException) { |
|
| 78 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
| 79 | - } |
|
| 80 | - elseif ($exception instanceof NotFoundHttpException) { |
|
| 81 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 82 | - } |
|
| 83 | - else { |
|
| 84 | - $this->caughtException($exception); |
|
| 85 | - } |
|
| 76 | + ob_start(); |
|
| 77 | + if ($exception instanceof TokenMismatchException) { |
|
| 78 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to your home page ...')); |
|
| 79 | + } |
|
| 80 | + elseif ($exception instanceof NotFoundHttpException) { |
|
| 81 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 82 | + } |
|
| 83 | + else { |
|
| 84 | + $this->caughtException($exception); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - return ob_get_clean(); |
|
| 87 | + return ob_get_clean(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function jsRedirectHomepage($message) |
| 91 | 91 | { |
| 92 | - $homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser()); |
|
| 92 | + $homepageUrl = url(\Epesi\Core\HomePage\Database\Models\HomePage::pathOfUser()); |
|
| 93 | 93 | |
| 94 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 94 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 95 | 95 | |
| 96 | - if ($this->isJsonRequest()) { |
|
| 97 | - $this->outputResponseJSON([ |
|
| 98 | - 'success' => true, |
|
| 99 | - 'message' => $message, |
|
| 100 | - 'atkjs' => $redirectJs |
|
| 101 | - ]); |
|
| 102 | - } |
|
| 103 | - else { |
|
| 104 | - $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
| 105 | - } |
|
| 96 | + if ($this->isJsonRequest()) { |
|
| 97 | + $this->outputResponseJSON([ |
|
| 98 | + 'success' => true, |
|
| 99 | + 'message' => $message, |
|
| 100 | + 'atkjs' => $redirectJs |
|
| 101 | + ]); |
|
| 102 | + } |
|
| 103 | + else { |
|
| 104 | + $this->outputResponseHTML('<script>' . $redirectJs . '</script>'); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function jsRedirectConfirm($page, $message) |
| 109 | 109 | { |
| 110 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 110 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 111 | 111 | |
| 112 | - return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 112 | + return new jsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -127,35 +127,35 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // jQuery |
| 129 | 129 | $urlJs = $this->cdn['jquery']?? $localJs; |
| 130 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
| 130 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
| 131 | 131 | |
| 132 | 132 | // Semantic UI |
| 133 | 133 | $urlJs = $this->cdn['semantic-ui']?? $localJs; |
| 134 | 134 | $urlCss = $this->cdn['semantic-ui']?? $localCss; |
| 135 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
| 136 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
| 135 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
| 136 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
| 137 | 137 | |
| 138 | 138 | // Serialize Object |
| 139 | 139 | $urlJs = $this->cdn['serialize-object']?? $localJs; |
| 140 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
| 140 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
| 141 | 141 | |
| 142 | 142 | // Agile UI |
| 143 | 143 | $urlJs = $this->cdn['atk']?? $localJs; |
| 144 | 144 | $urlCss = $this->cdn['atk']?? $localCss; |
| 145 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
| 146 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
| 145 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
| 146 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
| 147 | 147 | |
| 148 | 148 | // Draggable |
| 149 | 149 | $urlJs = $this->cdn['draggable']?? $localJs; |
| 150 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
| 150 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
| 151 | 151 | |
| 152 | 152 | // jQuery niceScroll |
| 153 | 153 | $urlJs = $this->cdn['jquery-nicescroll']?? $localJs; |
| 154 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
| 154 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
| 155 | 155 | |
| 156 | 156 | // clipboard.js |
| 157 | 157 | $urlJs = $this->cdn['clipboardjs']?? $localJs; |
| 158 | - $this->requireJS($urlJs.'/clipboard.js'); |
|
| 158 | + $this->requireJS($urlJs . '/clipboard.js'); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function addCsrfToken() |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $key = md5(serialize(func_get_args())); |
| 234 | 234 | |
| 235 | - if (! isset($cache[$key])) { |
|
| 235 | + if (!isset($cache[$key])) { |
|
| 236 | 236 | $cache[$key] = true; |
| 237 | 237 | |
| 238 | 238 | parent::requireJS($url, $isAsync, $isDefer); |