@@ -20,10 +20,10 @@ |
||
| 20 | 20 | | This value is the name of Epesi powered by as displayed. |
| 21 | 21 | | |
| 22 | 22 | */ |
| 23 | - 'credit' => [ |
|
| 24 | - 'title' => 'EPESI', |
|
| 25 | - 'link' => 'https://epe.si' |
|
| 26 | - ], |
|
| 23 | + 'credit' => [ |
|
| 24 | + 'title' => 'EPESI', |
|
| 25 | + 'link' => 'https://epe.si' |
|
| 26 | + ], |
|
| 27 | 27 | |
| 28 | 28 | /* |
| 29 | 29 | |-------------------------------------------------------------------------- |
@@ -2,35 +2,35 @@ |
||
| 2 | 2 | |
| 3 | 3 | if (! function_exists('epesi')) { |
| 4 | 4 | function ui() : Epesi\Core\UI |
| 5 | - { |
|
| 6 | - return resolve(Epesi\Core\UI::class); |
|
| 7 | - } |
|
| 5 | + { |
|
| 6 | + return resolve(Epesi\Core\UI::class); |
|
| 7 | + } |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | if (! function_exists('eval_css')) { |
| 11 | 11 | function eval_css($css) |
| 12 | - { |
|
| 13 | - ui()->addStyle($css); |
|
| 14 | - } |
|
| 12 | + { |
|
| 13 | + ui()->addStyle($css); |
|
| 14 | + } |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | if (! function_exists('eval_js')) { |
| 18 | 18 | function eval_js($js, $args = []) |
| 19 | - { |
|
| 20 | - ui()->addJS($js, $args); |
|
| 21 | - } |
|
| 19 | + { |
|
| 20 | + ui()->addJS($js, $args); |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (! function_exists('load_css')) { |
| 25 | 25 | function load_css($url) |
| 26 | - { |
|
| 27 | - return ui()->requireCSS($url); |
|
| 28 | - } |
|
| 26 | + { |
|
| 27 | + return ui()->requireCSS($url); |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (! function_exists('load_js')) { |
| 32 | 32 | function load_js($url) |
| 33 | - { |
|
| 34 | - return ui()->requireJS($url); |
|
| 35 | - } |
|
| 33 | + { |
|
| 34 | + return ui()->requireJS($url); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -1,34 +1,34 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('epesi')) { |
|
| 3 | +if (!function_exists('epesi')) { |
|
| 4 | 4 | function ui() : Epesi\Core\UI |
| 5 | 5 | { |
| 6 | 6 | return resolve(Epesi\Core\UI::class); |
| 7 | 7 | } |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if (! function_exists('eval_css')) { |
|
| 10 | +if (!function_exists('eval_css')) { |
|
| 11 | 11 | function eval_css($css) |
| 12 | 12 | { |
| 13 | 13 | ui()->addStyle($css); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if (! function_exists('eval_js')) { |
|
| 17 | +if (!function_exists('eval_js')) { |
|
| 18 | 18 | function eval_js($js, $args = []) |
| 19 | 19 | { |
| 20 | 20 | ui()->addJS($js, $args); |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if (! function_exists('load_css')) { |
|
| 24 | +if (!function_exists('load_css')) { |
|
| 25 | 25 | function load_css($url) |
| 26 | 26 | { |
| 27 | 27 | return ui()->requireCSS($url); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -if (! function_exists('load_js')) { |
|
| 31 | +if (!function_exists('load_js')) { |
|
| 32 | 32 | function load_js($url) |
| 33 | 33 | { |
| 34 | 34 | return ui()->requireJS($url); |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) { |
| 15 | - return ui()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer); |
|
| 15 | + return ui()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | final public static function requireCSS($file = 'default.css') { |
| 19 | - return ui()->requireCSS(self::assetUrl('css/'. $file)); |
|
| 19 | + return ui()->requireCSS(self::assetUrl('css/' . $file)); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | class UI extends Facade |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Get the registered name of the component. |
|
| 12 | - * |
|
| 13 | - * @return string |
|
| 14 | - */ |
|
| 15 | - protected static function getFacadeAccessor() |
|
| 16 | - { |
|
| 17 | - return App::class; |
|
| 18 | - } |
|
| 10 | + /** |
|
| 11 | + * Get the registered name of the component. |
|
| 12 | + * |
|
| 13 | + * @return string |
|
| 14 | + */ |
|
| 15 | + protected static function getFacadeAccessor() |
|
| 16 | + { |
|
| 17 | + return App::class; |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -85,11 +85,9 @@ discard block |
||
| 85 | 85 | ob_start(); |
| 86 | 86 | if ($exception instanceof TokenMismatchException) { |
| 87 | 87 | $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
| 88 | - } |
|
| 89 | - elseif ($exception instanceof NotFoundHttpException) { |
|
| 88 | + } elseif ($exception instanceof NotFoundHttpException) { |
|
| 90 | 89 | $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
| 91 | - } |
|
| 92 | - else { |
|
| 90 | + } else { |
|
| 93 | 91 | $this->caughtException($exception); |
| 94 | 92 | } |
| 95 | 93 | |
@@ -113,8 +111,7 @@ discard block |
||
| 113 | 111 | 'message' => $message, |
| 114 | 112 | 'atkjs' => $redirectJs |
| 115 | 113 | ]); |
| 116 | - } |
|
| 117 | - else { |
|
| 114 | + } else { |
|
| 118 | 115 | $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
| 119 | 116 | } |
| 120 | 117 | } |
@@ -146,36 +146,36 @@ discard block |
||
| 146 | 146 | $localCss = url('storage/system/css'); |
| 147 | 147 | |
| 148 | 148 | // jQuery |
| 149 | - $urlJs = $this->cdn['jquery']?? $localJs; |
|
| 150 | - $this->requireJS($urlJs.'/jquery.min.js'); |
|
| 149 | + $urlJs = $this->cdn['jquery'] ?? $localJs; |
|
| 150 | + $this->requireJS($urlJs . '/jquery.min.js'); |
|
| 151 | 151 | |
| 152 | 152 | // Semantic UI |
| 153 | - $urlJs = $this->cdn['semantic-ui']?? $localJs; |
|
| 154 | - $urlCss = $this->cdn['semantic-ui']?? $localCss; |
|
| 155 | - $this->requireJS($urlJs.'/semantic.min.js'); |
|
| 156 | - $this->requireCSS($urlCss.'/semantic.min.css'); |
|
| 153 | + $urlJs = $this->cdn['semantic-ui'] ?? $localJs; |
|
| 154 | + $urlCss = $this->cdn['semantic-ui'] ?? $localCss; |
|
| 155 | + $this->requireJS($urlJs . '/semantic.min.js'); |
|
| 156 | + $this->requireCSS($urlCss . '/semantic.min.css'); |
|
| 157 | 157 | |
| 158 | 158 | // Serialize Object |
| 159 | - $urlJs = $this->cdn['serialize-object']?? $localJs; |
|
| 160 | - $this->requireJS($urlJs.'/jquery.serialize-object.min.js'); |
|
| 159 | + $urlJs = $this->cdn['serialize-object'] ?? $localJs; |
|
| 160 | + $this->requireJS($urlJs . '/jquery.serialize-object.min.js'); |
|
| 161 | 161 | |
| 162 | 162 | // Agile UI |
| 163 | - $urlJs = $this->cdn['atk']?? $localJs; |
|
| 164 | - $urlCss = $this->cdn['atk']?? $localCss; |
|
| 165 | - $this->requireJS($urlJs.'/atkjs-ui.min.js'); |
|
| 166 | - $this->requireCSS($urlCss.'/agileui.css'); |
|
| 163 | + $urlJs = $this->cdn['atk'] ?? $localJs; |
|
| 164 | + $urlCss = $this->cdn['atk'] ?? $localCss; |
|
| 165 | + $this->requireJS($urlJs . '/atkjs-ui.min.js'); |
|
| 166 | + $this->requireCSS($urlCss . '/agileui.css'); |
|
| 167 | 167 | |
| 168 | 168 | // Draggable |
| 169 | - $urlJs = $this->cdn['draggable']?? $localJs; |
|
| 170 | - $this->requireJS($urlJs.'/draggable.bundle.js'); |
|
| 169 | + $urlJs = $this->cdn['draggable'] ?? $localJs; |
|
| 170 | + $this->requireJS($urlJs . '/draggable.bundle.js'); |
|
| 171 | 171 | |
| 172 | 172 | // jQuery niceScroll |
| 173 | - $urlJs = $this->cdn['jquery-nicescroll']?? $localJs; |
|
| 174 | - $this->requireJS($urlJs.'/jquery.nicescroll.js'); |
|
| 173 | + $urlJs = $this->cdn['jquery-nicescroll'] ?? $localJs; |
|
| 174 | + $this->requireJS($urlJs . '/jquery.nicescroll.js'); |
|
| 175 | 175 | |
| 176 | 176 | // clipboard.js |
| 177 | - $urlJs = $this->cdn['clipboardjs']?? $localJs; |
|
| 178 | - $this->requireJS($urlJs.'/clipboard.js'); |
|
| 177 | + $urlJs = $this->cdn['clipboardjs'] ?? $localJs; |
|
| 178 | + $this->requireJS($urlJs . '/clipboard.js'); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $key = md5(serialize(func_get_args())); |
| 260 | 260 | |
| 261 | - if (! isset($cache[$key])) { |
|
| 261 | + if (!isset($cache[$key])) { |
|
| 262 | 262 | $cache[$key] = true; |
| 263 | 263 | |
| 264 | 264 | parent::requireJS($url, $isAsync, $isDefer); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | parent::__construct([ |
| 27 | 27 | 'title' => config('epesi.ui.title', 'EPESI'), |
| 28 | - 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
| 28 | + 'cdn' => array_merge($this->cdn, (array) config('epesi.ui.cdn')), |
|
| 29 | 29 | //TODO: set the skin from admin / user selection |
| 30 | - 'skin' => config('epesi.ui.skin', $this->skin), |
|
| 31 | - 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
| 30 | + 'skin' => config('epesi.ui.skin', $this->skin), |
|
| 31 | + 'template_dir' => array_merge(ModuleManager::collect('templates', $this->skin), (array) $this->template_dir), |
|
| 32 | 32 | // 'catch_error_types' => config('app.debug') ? |
| 33 | 33 | // // debug mode |
| 34 | 34 | // E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED : |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | final public static function module() |
| 41 | 41 | { |
| 42 | - return System\SystemCore::class; |
|
| 42 | + return System\SystemCore::class; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function response() |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function render() |
| 60 | 60 | { |
| 61 | - System\SystemCore::requireCSS('epesi.css'); |
|
| 61 | + System\SystemCore::requireCSS('epesi.css'); |
|
| 62 | 62 | |
| 63 | 63 | $this->addCsrfToken(); |
| 64 | 64 | |
@@ -81,18 +81,18 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function renderException($exception) |
| 83 | 83 | { |
| 84 | - ob_start(); |
|
| 85 | - if ($exception instanceof TokenMismatchException) { |
|
| 86 | - $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
| 87 | - } |
|
| 88 | - elseif ($exception instanceof NotFoundHttpException) { |
|
| 89 | - $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 90 | - } |
|
| 91 | - else { |
|
| 92 | - $this->caughtException($exception); |
|
| 93 | - } |
|
| 84 | + ob_start(); |
|
| 85 | + if ($exception instanceof TokenMismatchException) { |
|
| 86 | + $this->jsRedirectHomepage(__('Session expired! Redirecting to login screen ...')); |
|
| 87 | + } |
|
| 88 | + elseif ($exception instanceof NotFoundHttpException) { |
|
| 89 | + $this->jsRedirectHomepage(__('Requested page not found! Redirecting to your home page ...')); |
|
| 90 | + } |
|
| 91 | + else { |
|
| 92 | + $this->caughtException($exception); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - return ob_get_clean(); |
|
| 95 | + return ob_get_clean(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function jsRedirectHomepage($message) |
| 104 | 104 | { |
| 105 | - $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); |
|
| 105 | + $homepageUrl = url(HomePage\Model\HomePage::pathOfUser()); |
|
| 106 | 106 | |
| 107 | - $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 107 | + $redirectJs = $this->jsRedirectConfirm($homepageUrl, $message)->jsRender(); |
|
| 108 | 108 | |
| 109 | - if ($this->isJsonRequest()) { |
|
| 110 | - $this->outputResponseJSON([ |
|
| 111 | - 'success' => true, |
|
| 112 | - 'message' => $message, |
|
| 113 | - 'atkjs' => $redirectJs |
|
| 114 | - ]); |
|
| 115 | - } |
|
| 116 | - else { |
|
| 117 | - $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
| 118 | - } |
|
| 109 | + if ($this->isJsonRequest()) { |
|
| 110 | + $this->outputResponseJSON([ |
|
| 111 | + 'success' => true, |
|
| 112 | + 'message' => $message, |
|
| 113 | + 'atkjs' => $redirectJs |
|
| 114 | + ]); |
|
| 115 | + } |
|
| 116 | + else { |
|
| 117 | + $this->outputResponseHTML($this->getTag('script', $redirectJs)); |
|
| 118 | + } |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function jsRedirectConfirm($page, $message) |
| 129 | 129 | { |
| 130 | - $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 130 | + $redirectJs = $this->jsRedirect($page)->jsRender(); |
|
| 131 | 131 | |
| 132 | - return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 132 | + return new \atk4\ui\JsExpression("if (confirm([])) { $redirectJs }", [$message]); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | return $weight1 <=> $weight2; |
| 43 | 43 | })->map(function($entry, $caption) use ($menu) { |
| 44 | - if (! ($entry['access'] ?? true)) return; |
|
| 44 | + if (! ($entry['access'] ?? true)) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | if (!is_array($entry)) { |
| 47 | 49 | $entry = ['action' => $entry]; |
@@ -60,13 +62,11 @@ discard block |
||
| 60 | 62 | // $submenu->js = ['transition' => 'swing left', 'on' => 'click']; |
| 61 | 63 | |
| 62 | 64 | self::addItems($submenu, collect($subitems)); |
| 63 | - } |
|
| 64 | - elseif ($subitems = $entry['group'] ?? []) { |
|
| 65 | + } elseif ($subitems = $entry['group'] ?? []) { |
|
| 65 | 66 | $subgroup = $menu->addGroup($entry['item']); |
| 66 | 67 | |
| 67 | 68 | self::addItems($subgroup, collect($subitems)); |
| 68 | - } |
|
| 69 | - else { |
|
| 69 | + } else { |
|
| 70 | 70 | $menu->addItem($entry['item'], $entry['action'] ?? ''); |
| 71 | 71 | } |
| 72 | 72 | }); |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class NavMenu extends BaseMenu |
| 11 | 11 | { |
| 12 | - public $ui = 'inverted nav menu'; |
|
| 12 | + public $ui = 'inverted nav menu'; |
|
| 13 | 13 | |
| 14 | 14 | // public $defaultTemplate = 'layout/maestro-sidenav.html'; |
| 15 | 15 | |
| 16 | - protected function init(): void |
|
| 16 | + protected function init(): void |
|
| 17 | 17 | { |
| 18 | 18 | parent::init(); |
| 19 | 19 | |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | self::addItems($submenu, collect($subitems)); |
| 65 | 65 | } |
| 66 | 66 | elseif ($subitems = $entry['group'] ?? []) { |
| 67 | - $subgroup = $menu->addGroup($entry['item']); |
|
| 67 | + $subgroup = $menu->addGroup($entry['item']); |
|
| 68 | 68 | |
| 69 | 69 | self::addItems($subgroup, collect($subitems)); |
| 70 | 70 | } |
| 71 | 71 | else { |
| 72 | - $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
| 72 | + $menu->addItem($entry['item'], $entry['action'] ?? ''); |
|
| 73 | 73 | } |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->addHeader($this->getApp()->title); |
| 21 | 21 | |
| 22 | 22 | $items = collect(); |
| 23 | - foreach(NavMenuJoint::collect() as $joint) { |
|
| 23 | + foreach (NavMenuJoint::collect() as $joint) { |
|
| 24 | 24 | $items = $items->merge($joint->items()); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public static function addItems($menu, Collection $items) |
| 39 | 39 | { |
| 40 | - $items->sort(function ($entry1, $entry2) { |
|
| 41 | - $weight1 = $entry1['weight']?? 10; |
|
| 42 | - $weight2 = $entry2['weight']?? 10; |
|
| 40 | + $items->sort(function($entry1, $entry2) { |
|
| 41 | + $weight1 = $entry1['weight'] ?? 10; |
|
| 42 | + $weight2 = $entry2['weight'] ?? 10; |
|
| 43 | 43 | |
| 44 | 44 | return $weight1 <=> $weight2; |
| 45 | 45 | })->map(function($entry, $caption) use ($menu) { |
| 46 | - if (! ($entry['access'] ?? true)) return; |
|
| 46 | + if (!($entry['access'] ?? true)) return; |
|
| 47 | 47 | |
| 48 | 48 | if (!is_array($entry)) { |
| 49 | 49 | $entry = ['action' => $entry]; |
@@ -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 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | 'icon' => 'th' |
| 44 | 44 | ], new LaunchPad($this)); |
| 45 | 45 | |
| 46 | - foreach(UserMenuJoint::collect() as $joint) { |
|
| 47 | - foreach ($joint->tools()?: [] as $tool) { |
|
| 46 | + foreach (UserMenuJoint::collect() as $joint) { |
|
| 47 | + foreach ($joint->tools() ?: [] as $tool) { |
|
| 48 | 48 | $this->addTool($tool); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - foreach ($joint->entries()?: [] as $entry) { |
|
| 51 | + foreach ($joint->entries() ?: [] as $entry) { |
|
| 52 | 52 | $this->addEntry($entry); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'item' => ['Logout', 'icon' => 'sign out', 'attr' => ['onclick' => "event.preventDefault();$('#logout-form').submit();"]], |
| 67 | 67 | 'action' => url('logout'), |
| 68 | 68 | 'group' => '10000:user', |
| 69 | - 'callback' => function ($item) { |
|
| 69 | + 'callback' => function($item) { |
|
| 70 | 70 | $logoutForm = View::addTo($item, [ |
| 71 | 71 | 'id' => 'logout-form', |
| 72 | 72 | 'attr' => [ |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function getUserMenuLabel() |
| 97 | 97 | { |
| 98 | - return $this->userMenuLabel?: Auth::user()->name; |
|
| 98 | + return $this->userMenuLabel ?: Auth::user()->name; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function addEntry($entry) |
| 102 | 102 | { |
| 103 | 103 | $entry = collect(array_merge(['item' => $entry, 'group' => '00500:general', 'weight' => 10], $entry)); |
| 104 | 104 | |
| 105 | - if (! $entry->get('item')) return; |
|
| 105 | + if (!$entry->get('item')) return; |
|
| 106 | 106 | |
| 107 | 107 | $this->entries->add($entry); |
| 108 | 108 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $item = $this->userMenu->addItem($entry['item'], $entry->get('action')); |
| 132 | 132 | |
| 133 | - if (! $callback = $entry->get('callback')) continue; |
|
| 133 | + if (!$callback = $entry->get('callback')) continue; |
|
| 134 | 134 | |
| 135 | 135 | $callback($item); |
| 136 | 136 | } |
@@ -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 | |
@@ -15,52 +15,52 @@ discard block |
||
| 15 | 15 | protected $validationRules = []; |
| 16 | 16 | |
| 17 | 17 | public function addElements($elements, $parent = null) { |
| 18 | - $parent = $parent?: $this; |
|
| 18 | + $parent = $parent ?: $this; |
|
| 19 | 19 | |
| 20 | 20 | foreach ($elements as $name => $desc) { |
| 21 | - $name = $desc['name']?? $name; |
|
| 21 | + $name = $desc['name'] ?? $name; |
|
| 22 | 22 | |
| 23 | - $this->addFieldRules($name, $desc['rules']?? []); |
|
| 23 | + $this->addFieldRules($name, $desc['rules'] ?? []); |
|
| 24 | 24 | |
| 25 | - switch ($desc['type']?? 'field') { |
|
| 25 | + switch ($desc['type'] ?? 'field') { |
|
| 26 | 26 | case 'field': |
| 27 | - $desc = is_string($desc)? [ |
|
| 27 | + $desc = is_string($desc) ? [ |
|
| 28 | 28 | 'decorator' => [$desc] |
| 29 | - ]: $desc; |
|
| 29 | + ] : $desc; |
|
| 30 | 30 | |
| 31 | - $field = $parent->addControl($name, $desc['decorator']?? [], $desc['options']?? []); |
|
| 31 | + $field = $parent->addControl($name, $desc['decorator'] ?? [], $desc['options'] ?? []); |
|
| 32 | 32 | |
| 33 | 33 | if ($default = $desc['default']) { |
| 34 | 34 | $field->set($default); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if ($desc['display']?? false) { |
|
| 37 | + if ($desc['display'] ?? false) { |
|
| 38 | 38 | $this->addFieldsDisplayRules([$name => $desc['display']]); |
| 39 | 39 | } |
| 40 | 40 | break; |
| 41 | 41 | |
| 42 | 42 | case 'group': |
| 43 | - $seed = $desc['seed']?? [$name]; |
|
| 43 | + $seed = $desc['seed'] ?? [$name]; |
|
| 44 | 44 | |
| 45 | 45 | $group = $parent->addGroup($seed); |
| 46 | 46 | |
| 47 | 47 | $this->addElements($desc['elements'], $group); |
| 48 | 48 | |
| 49 | - if ($desc['display']?? false) { |
|
| 49 | + if ($desc['display'] ?? false) { |
|
| 50 | 50 | $this->addGroupDisplayRules([$name => $desc['display']]); |
| 51 | 51 | } |
| 52 | 52 | break; |
| 53 | 53 | |
| 54 | 54 | case 'header': |
| 55 | - $seed = $desc['seed']?? [$name]; |
|
| 55 | + $seed = $desc['seed'] ?? [$name]; |
|
| 56 | 56 | |
| 57 | 57 | $parent->addHeader($seed); |
| 58 | 58 | break; |
| 59 | 59 | |
| 60 | 60 | case 'view': |
| 61 | - $seed = $desc['seed']?? ['Label', $name]; |
|
| 61 | + $seed = $desc['seed'] ?? ['Label', $name]; |
|
| 62 | 62 | |
| 63 | - $region = $desc['region']?? null; |
|
| 63 | + $region = $desc['region'] ?? null; |
|
| 64 | 64 | |
| 65 | 65 | $this->add($seed, $region); |
| 66 | 66 | break; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function addFieldsDisplayRules($fieldsDisplayRules) { |
| 78 | - $this->setControlsDisplayRules(array_merge($this->fieldsDisplayRules?: [], $fieldsDisplayRules)); |
|
| 78 | + $this->setControlsDisplayRules(array_merge($this->fieldsDisplayRules ?: [], $fieldsDisplayRules)); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function addGroupDisplayRules($groupDisplayRules) { |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function addFieldRules($field, $rules = []) { |
| 90 | - if (! $rules) return; |
|
| 90 | + if (!$rules) return; |
|
| 91 | 91 | |
| 92 | - $this->fieldRules[$field] = $rules['rules']?? [ |
|
| 92 | + $this->fieldRules[$field] = $rules['rules'] ?? [ |
|
| 93 | 93 | 'identifier' => $field, |
| 94 | 94 | 'rules' => $rules |
| 95 | 95 | ]; |
@@ -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 | } |
@@ -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) |
@@ -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(): void |
|
| 31 | - { |
|
| 32 | - $this->addIcon(); |
|
| 30 | + public function renderView(): void |
|
| 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 = JsCallback::addTo($this)->set($callable); |
|
| 77 | - } |
|
| 75 | + if (is_callable($callable)) { |
|
| 76 | + $callable = JsCallback::addTo($this)->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,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 = JsCallback::addTo($this)->set($callable); |