@@ -6,48 +6,48 @@ |
||
6 | 6 | |
7 | 7 | class SetEnvCommand extends Command |
8 | 8 | { |
9 | - /** |
|
10 | - * The name and signature of the console command. |
|
11 | - * |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
9 | + /** |
|
10 | + * The name and signature of the console command. |
|
11 | + * |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * The console command description. |
|
18 | - * |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - protected $description = 'Update ENV variable'; |
|
16 | + /** |
|
17 | + * The console command description. |
|
18 | + * |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + protected $description = 'Update ENV variable'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Execute the console command. |
|
25 | - */ |
|
26 | - public function handle() |
|
27 | - { |
|
28 | - $this->setEnv($this->argument('name'), $this->argument('value')); |
|
29 | - } |
|
23 | + /** |
|
24 | + * Execute the console command. |
|
25 | + */ |
|
26 | + public function handle() |
|
27 | + { |
|
28 | + $this->setEnv($this->argument('name'), $this->argument('value')); |
|
29 | + } |
|
30 | 30 | |
31 | - private static function setEnv($name, $value = null) |
|
32 | - { |
|
33 | - $env = $name; |
|
34 | - if (is_string($name) && !isset($value)) { |
|
35 | - $env = [ |
|
36 | - $name => $value |
|
37 | - ]; |
|
38 | - } |
|
31 | + private static function setEnv($name, $value = null) |
|
32 | + { |
|
33 | + $env = $name; |
|
34 | + if (is_string($name) && !isset($value)) { |
|
35 | + $env = [ |
|
36 | + $name => $value |
|
37 | + ]; |
|
38 | + } |
|
39 | 39 | |
40 | - foreach ($env as $key => $value) { |
|
41 | - $oldSetting = $key . '=' . env($key); |
|
42 | - $newSetting = $key . '=' . $value; |
|
40 | + foreach ($env as $key => $value) { |
|
41 | + $oldSetting = $key . '=' . env($key); |
|
42 | + $newSetting = $key . '=' . $value; |
|
43 | 43 | |
44 | - putenv($newSetting); |
|
44 | + putenv($newSetting); |
|
45 | 45 | |
46 | - file_put_contents(app()->environmentFilePath(), str_replace( |
|
47 | - $oldSetting, |
|
48 | - $newSetting, |
|
49 | - file_get_contents(app()->environmentFilePath()) |
|
50 | - )); |
|
51 | - } |
|
52 | - } |
|
46 | + file_put_contents(app()->environmentFilePath(), str_replace( |
|
47 | + $oldSetting, |
|
48 | + $newSetting, |
|
49 | + file_get_contents(app()->environmentFilePath()) |
|
50 | + )); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | |
7 | 7 | class CreateCoreTables extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - $this->down(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + $this->down(); |
|
17 | 17 | |
18 | - Schema::create('variables', function (Blueprint $table) { |
|
19 | - $table->string('name', 128)->primary(); |
|
20 | - $table->text('value'); |
|
21 | - }); |
|
18 | + Schema::create('variables', function (Blueprint $table) { |
|
19 | + $table->string('name', 128)->primary(); |
|
20 | + $table->text('value'); |
|
21 | + }); |
|
22 | 22 | |
23 | - Schema::create('modules', function (Blueprint $table) { |
|
24 | - $table->string('class', 512); |
|
25 | - $table->string('alias', 128)->unique(); |
|
26 | - $table->smallInteger('priority')->default(0); |
|
27 | - $table->smallInteger('state')->default(1); |
|
28 | - }); |
|
29 | - } |
|
23 | + Schema::create('modules', function (Blueprint $table) { |
|
24 | + $table->string('class', 512); |
|
25 | + $table->string('alias', 128)->unique(); |
|
26 | + $table->smallInteger('priority')->default(0); |
|
27 | + $table->smallInteger('state')->default(1); |
|
28 | + }); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Reverse the migrations. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function down() |
|
37 | - { |
|
38 | - Schema::dropIfExists('variables'); |
|
31 | + /** |
|
32 | + * Reverse the migrations. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function down() |
|
37 | + { |
|
38 | + Schema::dropIfExists('variables'); |
|
39 | 39 | |
40 | - Schema::dropIfExists('modules'); |
|
41 | - } |
|
40 | + Schema::dropIfExists('modules'); |
|
41 | + } |
|
42 | 42 | } |
@@ -15,12 +15,12 @@ |
||
15 | 15 | { |
16 | 16 | $this->down(); |
17 | 17 | |
18 | - Schema::create('variables', function (Blueprint $table) { |
|
18 | + Schema::create('variables', function(Blueprint $table) { |
|
19 | 19 | $table->string('name', 128)->primary(); |
20 | 20 | $table->text('value'); |
21 | 21 | }); |
22 | 22 | |
23 | - Schema::create('modules', function (Blueprint $table) { |
|
23 | + Schema::create('modules', function(Blueprint $table) { |
|
24 | 24 | $table->string('class', 512); |
25 | 25 | $table->string('alias', 128)->unique(); |
26 | 26 | $table->smallInteger('priority')->default(0); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | $paths = $this->migrations(); |
22 | 22 | |
23 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
23 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
24 | 24 | \Illuminate\Support\Facades\Artisan::call('migrate', ['--path' => $path, '--force' => true]); |
25 | 25 | } |
26 | 26 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $paths = $this->migrations(); |
33 | 33 | |
34 | - foreach (is_array($paths)? $paths: [$paths] as $path) { |
|
34 | + foreach (is_array($paths) ? $paths : [$paths] as $path) { |
|
35 | 35 | \Illuminate\Support\Facades\Artisan::call('migrate:rollback', ['--path' => $path]); |
36 | 36 | } |
37 | 37 |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
37 | 37 | $modules = $installedOnly? self::getInstalled(): self::getAll(); |
38 | 38 | |
39 | - if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
|
39 | + if (collect($modules)->contains($classOrAlias)) { |
|
40 | + return $classOrAlias; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | return $modules[$classOrAlias]?? null; |
42 | 44 | } |
@@ -138,7 +140,9 @@ discard block |
||
138 | 140 | |
139 | 141 | $ret = []; |
140 | 142 | foreach ($installedModules as $module) { |
141 | - if (! $list = $module::$method(...$args)) continue; |
|
143 | + if (! $list = $module::$method(...$args)) { |
|
144 | + continue; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | $ret = array_merge($ret, is_array($list)? $list: [$list]); |
144 | 148 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function isInstalled($classOrAlias) |
21 | 21 | { |
22 | - return self::getClass($classOrAlias, true)? 1: 0; |
|
22 | + return self::getClass($classOrAlias, true) ? 1 : 0; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function isAvalable($classOrAlias) |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return string; |
35 | 35 | */ |
36 | 36 | public static function getClass($classOrAlias, $installedOnly = false) { |
37 | - $modules = $installedOnly? self::getInstalled(): self::getAll(); |
|
37 | + $modules = $installedOnly ? self::getInstalled() : self::getAll(); |
|
38 | 38 | |
39 | 39 | if (collect($modules)->contains($classOrAlias)) return $classOrAlias; |
40 | 40 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function getAll() |
68 | 68 | { |
69 | - return self::getCached('epesi-modules-available', function () { |
|
69 | + return self::getCached('epesi-modules-available', function() { |
|
70 | 70 | $modules = collect(); |
71 | - foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules()?: []) as $moduleClass) { |
|
71 | + foreach (array_merge(config('epesi.modules', []), self::packageManifest()->modules() ?: []) as $moduleClass) { |
|
72 | 72 | $modules->add(['alias' => $moduleClass::alias(), 'class' => $moduleClass]); |
73 | 73 | } |
74 | 74 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected static function getCached($key, \Closure $default) |
87 | 87 | { |
88 | - if (! Cache::has($key)) { |
|
88 | + if (!Cache::has($key)) { |
|
89 | 89 | Cache::forever($key, $default()); |
90 | 90 | } |
91 | 91 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function collect($method, $args = []) |
123 | 123 | { |
124 | - $args = is_array($args)? $args: [$args]; |
|
124 | + $args = is_array($args) ? $args : [$args]; |
|
125 | 125 | |
126 | 126 | $installedModules = self::getInstalled(); |
127 | 127 | |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | $ret = []; |
136 | 136 | foreach ($installedModules as $module) { |
137 | - if (! $list = $module::$method(...$args)) continue; |
|
137 | + if (!$list = $module::$method(...$args)) continue; |
|
138 | 138 | |
139 | - $ret = array_merge($ret, is_array($list)? $list: [$list]); |
|
139 | + $ret = array_merge($ret, is_array($list) ? $list : [$list]); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $ret; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return true; |
156 | 156 | } |
157 | 157 | |
158 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
158 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
159 | 159 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
160 | 160 | } |
161 | 161 | |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | $parentModule = array_shift($unsatisfiedDependencies); |
207 | 207 | |
208 | 208 | if (self::$processing[$parentModule]?? false) { |
209 | - throw new Exception('Cross dependency: '. $parentModule); |
|
209 | + throw new Exception('Cross dependency: ' . $parentModule); |
|
210 | 210 | } |
211 | 211 | |
212 | - if (! self::isAvalable($parentModule)) { |
|
212 | + if (!self::isAvalable($parentModule)) { |
|
213 | 213 | throw new Exception('Module not found: "' . $parentModule . '"'); |
214 | 214 | } |
215 | 215 | |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | |
231 | 231 | public static function uninstall($classOrAlias) |
232 | 232 | { |
233 | - if (! self::isInstalled($classOrAlias)) { |
|
233 | + if (!self::isInstalled($classOrAlias)) { |
|
234 | 234 | print ('Module "' . $classOrAlias . '" is not installed!'); |
235 | 235 | |
236 | 236 | return true; |
237 | 237 | } |
238 | 238 | |
239 | - if (! $moduleClass = self::getClass($classOrAlias)) { |
|
239 | + if (!$moduleClass = self::getClass($classOrAlias)) { |
|
240 | 240 | throw new \Exception('Module "' . $classOrAlias . '" could not be identified'); |
241 | 241 | } |
242 | 242 |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class CreateHomePageTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - $this->down(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + $this->down(); |
|
17 | 17 | |
18 | - Schema::create('home_pages', function (Blueprint $table) { |
|
19 | - $table->increments('id'); |
|
20 | - $table->string('path', 64); |
|
21 | - $table->string('role', 64); |
|
22 | - $table->smallInteger('priority'); |
|
23 | - }); |
|
24 | - } |
|
18 | + Schema::create('home_pages', function (Blueprint $table) { |
|
19 | + $table->increments('id'); |
|
20 | + $table->string('path', 64); |
|
21 | + $table->string('role', 64); |
|
22 | + $table->smallInteger('priority'); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('home_pages'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('home_pages'); |
|
34 | + } |
|
35 | 35 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $this->down(); |
17 | 17 | |
18 | - Schema::create('home_pages', function (Blueprint $table) { |
|
18 | + Schema::create('home_pages', function(Blueprint $table) { |
|
19 | 19 | $table->increments('id'); |
20 | 20 | $table->string('path', 64); |
21 | 21 | $table->string('role', 64); |
@@ -34,7 +34,9 @@ |
||
34 | 34 | */ |
35 | 35 | public static function getUserHomePage() |
36 | 36 | { |
37 | - if (! $user = Auth::user()) return; |
|
37 | + if (! $user = Auth::user()) { |
|
38 | + return; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | return HomePage::whereIn('role', $user->roles()->pluck('name'))->orderBy('priority')->first(); |
40 | 42 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | static $cache; |
26 | 26 | |
27 | - if (! isset($cache)) { |
|
27 | + if (!isset($cache)) { |
|
28 | 28 | $cache = []; |
29 | 29 | foreach (HomePageJoint::collect() as $joint) { |
30 | 30 | $cache[$joint->link()] = $joint->caption(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function getUserHomePage() |
43 | 43 | { |
44 | - if (! $user = Auth::user()) return; |
|
44 | + if (!$user = Auth::user()) return; |
|
45 | 45 | |
46 | 46 | return HomePage::whereIn('role', $user->roles()->pluck('name'))->orderBy('priority')->first(); |
47 | 47 | } |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | { |
56 | 56 | $homepage = self::getUserHomePage(); |
57 | 57 | |
58 | - return $homepage? $homepage->path: self::$defaultPath; |
|
58 | + return $homepage ? $homepage->path : self::$defaultPath; |
|
59 | 59 | } |
60 | 60 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return [['Template', $availablePages[$row[$column]]]]; |
46 | 46 | }]); |
47 | 47 | |
48 | - $this->grid->addDragHandler()->onReorder(function ($order) { |
|
48 | + $this->grid->addDragHandler()->onReorder(function($order) { |
|
49 | 49 | $result = true; |
50 | 50 | foreach ($this->getHomepages() as $homepage) { |
51 | 51 | $homepage->priority = array_search($homepage->id, $order); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $result &= $homepage->save(); |
54 | 54 | } |
55 | 55 | |
56 | - return $result? $this->notify(__('Homepages reordered!')): $this->notifyError(__('Error saving order!')); |
|
56 | + return $result ? $this->notify(__('Homepages reordered!')) : $this->notifyError(__('Error saving order!')); |
|
57 | 57 | }); |
58 | 58 | |
59 | - $this->grid->addAction(['icon' => 'red trash'], function ($jschain, $id) { |
|
59 | + $this->grid->addAction(['icon' => 'red trash'], function($jschain, $id) { |
|
60 | 60 | HomePage::find($id)->delete(); |
61 | 61 | |
62 | 62 | return $jschain->closest('tr')->transition('fade left'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function getHomepageForm() |
94 | 94 | { |
95 | - if (! $this->form) { |
|
95 | + if (!$this->form) { |
|
96 | 96 | $this->form = new Form(['buttonSave' => ['Button', __('Save'), 'primary']]); |
97 | 97 | |
98 | 98 | $this->form->addHook('submit', function($form) { |
@@ -9,66 +9,66 @@ |
||
9 | 9 | |
10 | 10 | class EpesiServiceProvider extends ServiceProvider |
11 | 11 | { |
12 | - /** |
|
13 | - * Booting the package. |
|
14 | - */ |
|
15 | - public function boot() |
|
16 | - { |
|
17 | - $this->ensureHttps(); |
|
12 | + /** |
|
13 | + * Booting the package. |
|
14 | + */ |
|
15 | + public function boot() |
|
16 | + { |
|
17 | + $this->ensureHttps(); |
|
18 | 18 | |
19 | - Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
20 | - header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
21 | - header("Pragma: no-cache"); //HTTP 1.0 |
|
22 | - header("Expires: 0"); |
|
19 | + Route::group(['namespace' => 'Epesi\Core\Controllers', 'middleware' => 'web'], function() { |
|
20 | + header("Cache-Control: no-cache, no-store, must-revalidate"); //HTTP 1.1 |
|
21 | + header("Pragma: no-cache"); //HTTP 1.0 |
|
22 | + header("Expires: 0"); |
|
23 | 23 | |
24 | - Route::any('/', 'HomeController@index'); |
|
25 | - Route::any('install', 'InstallController@index'); |
|
24 | + Route::any('/', 'HomeController@index'); |
|
25 | + Route::any('install', 'InstallController@index'); |
|
26 | 26 | |
27 | - Route::group(['middleware' => 'auth'], function() { |
|
28 | - Route::any('home', 'HomeController@home')->name('home'); |
|
27 | + Route::group(['middleware' => 'auth'], function() { |
|
28 | + Route::any('home', 'HomeController@home')->name('home'); |
|
29 | 29 | |
30 | - Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view'); |
|
31 | - }); |
|
32 | - }); |
|
30 | + Route::any('view/{alias}/{method?}/{args?}', 'ModuleController@view'); |
|
31 | + }); |
|
32 | + }); |
|
33 | 33 | |
34 | - // call boot methods on all modules |
|
35 | - ModuleManager::call('boot'); |
|
34 | + // call boot methods on all modules |
|
35 | + ModuleManager::call('boot'); |
|
36 | 36 | |
37 | 37 | foreach (ModuleManager::collect('translations') as $path) { |
38 | 38 | $this->loadJsonTranslationsFrom($path); |
39 | 39 | } |
40 | 40 | |
41 | - // Register admin service provider if in admin mode or in console |
|
42 | - // TODO: apply access restriction to admin mode |
|
41 | + // Register admin service provider if in admin mode or in console |
|
42 | + // TODO: apply access restriction to admin mode |
|
43 | 43 | // if ($this->app->runningInConsole() || (request('admin', false) && Auth::user()->can('modify system'))) { |
44 | - if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | - $this->app->register(AdminServiceProvider::class); |
|
46 | - } |
|
47 | - } |
|
44 | + if ($this->app->runningInConsole() || request('admin', false)) { |
|
45 | + $this->app->register(AdminServiceProvider::class); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Register the provider. |
|
51 | - */ |
|
52 | - public function register() |
|
53 | - { |
|
54 | - $this->app->singleton(App::class); |
|
55 | - } |
|
49 | + /** |
|
50 | + * Register the provider. |
|
51 | + */ |
|
52 | + public function register() |
|
53 | + { |
|
54 | + $this->app->singleton(App::class); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Force to set https scheme if https enabled. |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - protected function ensureHttps() |
|
63 | - { |
|
64 | - if (config('epesi.https') || config('epesi.secure')) { |
|
65 | - url()->forceScheme('https'); |
|
66 | - $this->app['request']->server->set('HTTPS', true); |
|
67 | - } |
|
68 | - } |
|
57 | + /** |
|
58 | + * Force to set https scheme if https enabled. |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + protected function ensureHttps() |
|
63 | + { |
|
64 | + if (config('epesi.https') || config('epesi.secure')) { |
|
65 | + url()->forceScheme('https'); |
|
66 | + $this->app['request']->server->set('HTTPS', true); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - protected function registerStorageDisk() |
|
71 | - { |
|
72 | - $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
73 | - } |
|
70 | + protected function registerStorageDisk() |
|
71 | + { |
|
72 | + $this->app['config']['filesystems.disks.epesi'] = config('epesi.disk'); |
|
73 | + } |
|
74 | 74 | } |
@@ -31,36 +31,36 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class LayoutView extends ModuleView |
33 | 33 | { |
34 | - public $menuLeft; // vertical menu |
|
35 | - public $menu; // horizontal menu |
|
36 | - public $menuRight; // vertical pull-down |
|
37 | - public $actionBar; |
|
38 | - public $locationBar; |
|
34 | + public $menuLeft; // vertical menu |
|
35 | + public $menu; // horizontal menu |
|
36 | + public $menuRight; // vertical pull-down |
|
37 | + public $actionBar; |
|
38 | + public $locationBar; |
|
39 | 39 | |
40 | - public $burger = true; // burger menu item |
|
40 | + public $burger = true; // burger menu item |
|
41 | 41 | |
42 | - /* |
|
42 | + /* |
|
43 | 43 | * Whether or not left Menu is visible on Page load. |
44 | 44 | */ |
45 | - public $isMenuLeftVisible = true; |
|
45 | + public $isMenuLeftVisible = true; |
|
46 | 46 | |
47 | - public $defaultTemplate = 'layout/admin.html'; |
|
47 | + public $defaultTemplate = 'layout/admin.html'; |
|
48 | 48 | |
49 | - protected $location; |
|
49 | + protected $location; |
|
50 | 50 | |
51 | - public function init() |
|
52 | - { |
|
53 | - parent::init(); |
|
51 | + public function init() |
|
52 | + { |
|
53 | + parent::init(); |
|
54 | 54 | |
55 | - $this->setMenu(); |
|
56 | - $this->setActionBar(); |
|
55 | + $this->setMenu(); |
|
56 | + $this->setActionBar(); |
|
57 | 57 | |
58 | 58 | // if (request()->pjax()) return; |
59 | 59 | |
60 | - $this->setMenuLeft(); |
|
61 | - $this->setMenuRight(); |
|
60 | + $this->setMenuLeft(); |
|
61 | + $this->setMenuRight(); |
|
62 | 62 | |
63 | - $this->setVersion(); |
|
63 | + $this->setVersion(); |
|
64 | 64 | |
65 | 65 | // $this->js(true, null, 'body')->niceScroll(); |
66 | 66 | // $this->js(true, null, new jsExpression('window'))->on('pageshow', new jsFunction(['event'], [ |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | // if (event.originalEvent.persisted) { |
69 | 69 | // window.location.reload(); |
70 | 70 | // }')])); |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function setMenu() |
|
74 | - { |
|
75 | - if ($this->menu) return; |
|
73 | + public function setMenu() |
|
74 | + { |
|
75 | + if ($this->menu) return; |
|
76 | 76 | |
77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - // company logo |
|
80 | - $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
79 | + // company logo |
|
80 | + $this->menu->add(['class' => ['epesi-logo']])->add(['Image', url('img/tsm_logo_agile.png')]); |
|
81 | 81 | |
82 | - if ($this->burger) { |
|
83 | - /** @scrutinizer ignore-call */ |
|
84 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
85 | - } |
|
82 | + if ($this->burger) { |
|
83 | + /** @scrutinizer ignore-call */ |
|
84 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | // home icon |
88 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
88 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
89 | 89 | |
90 | 90 | // location bar |
91 | 91 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -124,50 +124,50 @@ discard block |
||
124 | 124 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
125 | 125 | } |
126 | 126 | |
127 | - public function setMenuLeft() |
|
128 | - { |
|
129 | - if ($this->menuLeft) return; |
|
127 | + public function setMenuLeft() |
|
128 | + { |
|
129 | + if ($this->menuLeft) return; |
|
130 | 130 | |
131 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
131 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
132 | 132 | |
133 | - if (! $this->burger) return; |
|
133 | + if (! $this->burger) return; |
|
134 | 134 | |
135 | - if (! session()->get('menu', 1)) { |
|
136 | - $this->isMenuLeftVisible = false; |
|
137 | - } |
|
135 | + if (! session()->get('menu', 1)) { |
|
136 | + $this->isMenuLeftVisible = false; |
|
137 | + } |
|
138 | 138 | |
139 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
140 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
141 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
142 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
143 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
144 | - session()->put('menu', $visible? 1: 0); |
|
145 | - session()->save(); |
|
146 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
147 | - ]); |
|
148 | - } |
|
139 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
140 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
141 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
142 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
143 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
144 | + session()->put('menu', $visible? 1: 0); |
|
145 | + session()->save(); |
|
146 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
147 | + ]); |
|
148 | + } |
|
149 | 149 | |
150 | - public function setActionBar() |
|
151 | - { |
|
152 | - if ($this->actionBar) return; |
|
150 | + public function setActionBar() |
|
151 | + { |
|
152 | + if ($this->actionBar) return; |
|
153 | 153 | |
154 | - $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
155 | - } |
|
154 | + $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
|
155 | + } |
|
156 | 156 | |
157 | - public function setVersion() |
|
158 | - { |
|
159 | - $this->template->trySet('version', $this->app->version); |
|
160 | - } |
|
157 | + public function setVersion() |
|
158 | + { |
|
159 | + $this->template->trySet('version', $this->app->version); |
|
160 | + } |
|
161 | 161 | |
162 | - /** |
|
163 | - * {@inheritdoc} |
|
164 | - */ |
|
162 | + /** |
|
163 | + * {@inheritdoc} |
|
164 | + */ |
|
165 | 165 | |
166 | - public function renderView() |
|
167 | - { |
|
168 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
169 | - $this->menuLeft->addClass('visible'); |
|
170 | - } |
|
171 | - parent::renderView(); |
|
172 | - } |
|
166 | + public function renderView() |
|
167 | + { |
|
168 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
169 | + $this->menuLeft->addClass('visible'); |
|
170 | + } |
|
171 | + parent::renderView(); |
|
172 | + } |
|
173 | 173 | } |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class LayoutView extends ModuleView |
33 | 33 | { |
34 | - public $menuLeft; // vertical menu |
|
35 | - public $menu; // horizontal menu |
|
36 | - public $menuRight; // vertical pull-down |
|
34 | + public $menuLeft; // vertical menu |
|
35 | + public $menu; // horizontal menu |
|
36 | + public $menuRight; // vertical pull-down |
|
37 | 37 | public $actionBar; |
38 | 38 | public $locationBar; |
39 | 39 | |
40 | - public $burger = true; // burger menu item |
|
40 | + public $burger = true; // burger menu item |
|
41 | 41 | |
42 | 42 | /* |
43 | 43 | * Whether or not left Menu is visible on Page load. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
89 | 89 | |
90 | 90 | // location bar |
91 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
91 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function setLocation($crumbs) |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | |
131 | 131 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
132 | 132 | |
133 | - if (! $this->burger) return; |
|
133 | + if (!$this->burger) return; |
|
134 | 134 | |
135 | - if (! session()->get('menu', 1)) { |
|
135 | + if (!session()->get('menu', 1)) { |
|
136 | 136 | $this->isMenuLeftVisible = false; |
137 | 137 | } |
138 | 138 | |
139 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
139 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
140 | 140 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
141 | 141 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
142 | 142 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
143 | 143 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
144 | - session()->put('menu', $visible? 1: 0); |
|
144 | + session()->put('menu', $visible ? 1 : 0); |
|
145 | 145 | session()->save(); |
146 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
146 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
147 | 147 | ]); |
148 | 148 | } |
149 | 149 |
@@ -72,7 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | public function setMenu() |
74 | 74 | { |
75 | - if ($this->menu) return; |
|
75 | + if ($this->menu) { |
|
76 | + return; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
78 | 80 | |
@@ -117,7 +119,9 @@ discard block |
||
117 | 119 | |
118 | 120 | public function setMenuRight() |
119 | 121 | { |
120 | - if ($this->menuRight) return; |
|
122 | + if ($this->menuRight) { |
|
123 | + return; |
|
124 | + } |
|
121 | 125 | |
122 | 126 | $this->menuRight = $this->menu->add(new Seeds\RightMenu([ |
123 | 127 | 'ui' => false |
@@ -126,11 +130,15 @@ discard block |
||
126 | 130 | |
127 | 131 | public function setMenuLeft() |
128 | 132 | { |
129 | - if ($this->menuLeft) return; |
|
133 | + if ($this->menuLeft) { |
|
134 | + return; |
|
135 | + } |
|
130 | 136 | |
131 | 137 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
132 | 138 | |
133 | - if (! $this->burger) return; |
|
139 | + if (! $this->burger) { |
|
140 | + return; |
|
141 | + } |
|
134 | 142 | |
135 | 143 | if (! session()->get('menu', 1)) { |
136 | 144 | $this->isMenuLeftVisible = false; |
@@ -149,7 +157,9 @@ discard block |
||
149 | 157 | |
150 | 158 | public function setActionBar() |
151 | 159 | { |
152 | - if ($this->actionBar) return; |
|
160 | + if ($this->actionBar) { |
|
161 | + return; |
|
162 | + } |
|
153 | 163 | |
154 | 164 | $this->actionBar = $this->add(new Seeds\ActionBar(), 'ActionBar'); |
155 | 165 | } |