Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 7a551fe

Browse files
committed
make pages controller fully dynamic
- make pages controller fully dynamic - fix menu list not taking full height - cleanup pages seeder …
1 parent a083e80 commit 7a551fe

File tree

7 files changed

+18
-60
lines changed

7 files changed

+18
-60
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ return [
100100
*/
101101
'routeListPath' => storage_path('logs/simpleMenu.php'),
102102

103-
/*
104-
* dynamic pages controller namespace
105-
*/
106-
'pagesControllerNS' => 'App\Http\Controllers',
107-
108103
/*
109104
* where to redirect when a route is available in one locale "en" but not in another "fr" ?
110105
*/

src/Traits/RoutesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected function routeGen($page)
9393
$route = $this->getRouteUrl($url, $prefix);
9494

9595
$uses = $action
96-
? config('simpleMenu.pagesControllerNS') . '\\' . $action
96+
? $action
9797
: '\ctf0\SimpleMenu\Controllers\DummyController@handle';
9898

9999
// dynamic

src/config/simpleMenu.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
*/
2323
'routeListPath' => storage_path('logs/simpleMenu.php'),
2424

25-
/*
26-
* dynamic pages controller namespace
27-
*/
28-
'pagesControllerNS' => 'App\Http\Controllers',
29-
3025
/*
3126
* where to redirect when a route is available in one locale "en" but not in another "fr" ?
3227
*

src/database/seeds/PagesTableSeeder.php

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,54 +13,8 @@ public function run()
1313
{
1414
$faker = Factory::create();
1515

16-
Page::create([
17-
'template' => 'hero',
18-
'route_name'=> str_slug('Home'),
19-
'action' => 'PageController@' . camel_case('Home'),
20-
'title' => [
21-
'en' => title_case('Home'),
22-
'fr' => title_case('Home'),
23-
],
24-
'body' => [
25-
'en' => $faker->text(),
26-
'fr' => $faker->text(),
27-
],
28-
'desc' => [
29-
'en' => $faker->text(),
30-
'fr' => $faker->text(),
31-
],
32-
'url' => [
33-
'en' => '/',
34-
'fr' => '/',
35-
],
36-
]);
37-
38-
$heros = ['About', 'Contact Us'];
39-
foreach ($heros as $one) {
40-
Page::create([
41-
'template' => 'hero',
42-
'route_name'=> str_slug($one),
43-
'action' => 'PageController@' . camel_case($one),
44-
'title' => [
45-
'en' => title_case($one),
46-
'fr' => title_case($one),
47-
],
48-
'body' => [
49-
'en' => $faker->text(),
50-
'fr' => $faker->text(),
51-
],
52-
'desc' => [
53-
'en' => $faker->text(),
54-
'fr' => $faker->text(),
55-
],
56-
'url' => [
57-
'en' => str_slug($one),
58-
'fr' => str_slug($one),
59-
],
60-
]);
61-
}
62-
6316
$i = 1;
17+
6418
while ($i <= 20) {
6519
$en = $faker->unique()->city;
6620
$fr = $faker->unique()->city;

src/resources/assets/sass/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ thead th {
129129

130130
.menu-list {
131131
line-height: inherit;
132+
height: 100%;
132133
}
133134

134135
.dragArea {

src/resources/views/admin/bulma/pages/create.blade.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ class="input toggle-pad"
5656
<div class="field">
5757
{{ Form::label('action', trans('SimpleMenu::messages.action'), ['class' => 'label']) }}
5858
<div class="control">
59-
{{ Form::text('action', null, ['class' => 'input', 'placeholder'=>"SomeController@index"]) }}
59+
{{ Form::text(
60+
'action',
61+
null,
62+
['class' => 'input',
63+
'placeholder'=>"App\Http\Controllers\SomeController@index",
64+
'ref'=>'action'])
65+
}}
66+
<span class="help">
67+
<code class="link" data-value="App\Http\Controllers\" @click="$refs.action.value = $event.target.dataset.value">App\Http\Controllers\</code>
68+
</span>
6069
</div>
6170
@if($errors->has('action'))
6271
<p class="help is-danger">

src/resources/views/admin/bulma/pages/edit.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ class="input toggle-pad"
7070
'action',
7171
$page->action,
7272
['class' => 'input',
73-
'placeholder'=>"SomeController@index"])
73+
'placeholder'=>"App\Http\Controllers\SomeController@index",
74+
'ref'=>'action'])
7475
}}
76+
<span class="help">
77+
<code class="link" data-value="App\Http\Controllers\" @click="$refs.action.value = $event.target.dataset.value">App\Http\Controllers\</code>
78+
</span>
7579
</div>
7680
@if($errors->has('action'))
7781
<p class="help is-danger">

0 commit comments

Comments
 (0)