generator-folklore 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. package/lib/generators/intl/index.js +93 -0
  2. package/lib/generators/laravel-mediatheque/index.js +133 -0
  3. package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
  4. package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
  5. package/lib/generators/laravel-panneau/index.js +49 -28
  6. package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
  7. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
  8. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
  9. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
  10. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
  11. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
  12. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
  13. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
  14. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
  15. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
  16. package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
  17. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
  18. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
  19. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
  20. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
  21. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
  22. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
  23. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
  24. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
  25. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
  26. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
  27. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
  28. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
  29. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
  30. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
  31. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
  32. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
  33. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
  34. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
  35. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
  36. package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
  37. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
  38. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
  39. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
  40. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
  41. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
  42. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
  43. package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
  44. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
  45. package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
  46. package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
  47. package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
  48. package/lib/generators/laravel-panneau/templates/index.js +32 -0
  49. package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
  50. package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
  51. package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
  52. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
  53. package/lib/generators/laravel-panneau/templates/{app/Schemas/Fields/.gitkeep → resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
  54. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
  55. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
  56. package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
  57. package/lib/generators/laravel-panneau/templates/routes.php +30 -0
  58. package/lib/generators/laravel-project/index.js +504 -0
  59. package/lib/generators/laravel-project/templates/env +41 -0
  60. package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
  61. package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
  62. package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
  63. package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
  64. package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
  65. package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
  66. package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
  67. package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
  68. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
  69. package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
  70. package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
  71. package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
  72. package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
  73. package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
  74. package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
  75. package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
  76. package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
  77. package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
  78. package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
  79. package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
  80. package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
  81. package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
  82. package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
  83. package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
  84. package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
  85. package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
  86. package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
  87. package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
  88. package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
  89. package/lib/generators/laravel-project/templates/laravel/resources/assets/fonts/.gitkeep +0 -0
  90. package/lib/generators/laravel-project/templates/laravel/resources/assets/img/.gitkeep +0 -0
  91. package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
  92. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
  93. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
  94. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
  95. package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
  96. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
  97. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
  98. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
  99. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
  100. package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
  101. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
  102. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
  103. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
  104. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
  105. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
  106. package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
  107. package/lib/generators/react-app/templates/src/components/App.jsx +3 -2
  108. package/lib/generators/react-app/templates/src/components/pages/Error.jsx +2 -2
  109. package/lib/lib/generator.js +9 -0
  110. package/package.json +2 -2
  111. package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
  112. package/lib/generators/laravel-panneau/templates/_package.json +0 -11
  113. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
  114. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
  115. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
  116. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
  117. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
  118. package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
  119. package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
  120. package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
  121. package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
  122. package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
  123. package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
  124. package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
  125. package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -0,0 +1,110 @@
1
+ <?php
2
+
3
+ namespace App\Panneau\Resources\Blocks;
4
+
5
+ use Panneau\Contracts\ResourceType;
6
+ use Panneau\Contracts\Repository;
7
+ use Panneau\Contracts\Resource;
8
+ use Panneau\Contracts\ResourceItem;
9
+ use App\Panneau\Fields\Blocks;
10
+ use JsonSerializable;
11
+ use Illuminate\Contracts\Support\Arrayable;
12
+ use Illuminate\Contracts\Support\Jsonable;
13
+
14
+ class BlockWithBlocks implements ResourceType, Arrayable, Jsonable
15
+ {
16
+ protected $type;
17
+
18
+ protected $depth;
19
+
20
+ public function __construct(ResourceType $type, $depth)
21
+ {
22
+ $this->type = $type;
23
+ $this->depth = $depth;
24
+ }
25
+
26
+ public function currentDepth(): int
27
+ {
28
+ return $this->depth;
29
+ }
30
+
31
+ public function id(): string
32
+ {
33
+ return $this->type->id();
34
+ }
35
+
36
+ public function name(): string
37
+ {
38
+ return $this->type->name();
39
+ }
40
+
41
+ public function fields(): array
42
+ {
43
+ return collect($this->type->fields())
44
+ ->map(function ($field) {
45
+ return $field instanceof Blocks ? $field->currentDepth($this->depth) : $field;
46
+ })
47
+ ->toArray();
48
+ }
49
+
50
+ public function resource(): Resource
51
+ {
52
+ return $this->type->resource();
53
+ }
54
+
55
+ public function settings(): ?array
56
+ {
57
+ return $this->type->settings();
58
+ }
59
+
60
+ public function makeRepository(): ?Repository
61
+ {
62
+ return $this->type->makeRepository();
63
+ }
64
+
65
+ public function makeJsonResource(ResourceItem $item): ?JsonSerializable
66
+ {
67
+ return $this->type->makeJsonResource($item);
68
+ }
69
+
70
+ public function makeJsonCollection($resources): ?JsonSerializable
71
+ {
72
+ return $this->type->makeJsonCollection($resources);
73
+ }
74
+
75
+ public function toArray()
76
+ {
77
+ $id = $this->id();
78
+ $data = [
79
+ 'id' => $this->id(),
80
+ 'name' => $this->name(),
81
+ 'fields' => collect($this->resource()->fields())
82
+ ->filter(function ($field) use ($id) {
83
+ $excepTypes = $field->exceptTypes();
84
+ $onlyTypes = $field->onlyTypes();
85
+ return (is_null($excepTypes) || !in_array($id, $excepTypes)) &&
86
+ (is_null($onlyTypes) || in_array($id, $onlyTypes));
87
+ })
88
+ ->merge($this->fields())
89
+ ->values()
90
+ ->toArray(),
91
+ ];
92
+
93
+ $settings = $this->settings();
94
+ if (isset($settings)) {
95
+ $data['settings'] = $settings;
96
+ }
97
+
98
+ return $data;
99
+ }
100
+
101
+ public function jsonSerialize()
102
+ {
103
+ return $this->type->jsonSerialize();
104
+ }
105
+
106
+ public function toJson($options = 0)
107
+ {
108
+ return $this->type->toJson($options);
109
+ }
110
+ }
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ namespace App\Panneau\Resources\Blocks;
4
+
5
+ use Panneau\Support\ResourceType;
6
+ use Panneau\Fields\HtmlLocalized;
7
+
8
+ class TextBlock extends ResourceType
9
+ {
10
+ public function id(): string
11
+ {
12
+ return 'text';
13
+ }
14
+
15
+ public function name(): string
16
+ {
17
+ return trans('panneau.blocks_text');
18
+ }
19
+
20
+ public function fields(): array
21
+ {
22
+ return [
23
+ HtmlLocalized::make('body')
24
+ ->withTransLabel('panneau.fields.body'),
25
+ ];
26
+ }
27
+ }
@@ -0,0 +1,42 @@
1
+ <?php
2
+
3
+ namespace App\Panneau\Resources;
4
+
5
+ use Panneau\Support\Resource;
6
+
7
+ class Blocks extends Resource
8
+ {
9
+ public static $repository = \App\Contracts\Repositories\Blocks::class;
10
+
11
+ public static $jsonResource = \App\Panneau\Http\Resources\BlockResource::class;
12
+
13
+ public static $jsonCollection = \App\Panneau\Http\Resources\BlocksCollection::class;
14
+
15
+ public static $settings = [
16
+ 'hideInNavbar' => true,
17
+ ];
18
+
19
+ public static $types = [\App\Panneau\Resources\Blocks\TextBlock::class];
20
+
21
+ public function name(): string
22
+ {
23
+ return trans('panneau.blocks.name');
24
+ }
25
+
26
+ public function index(): ?array
27
+ {
28
+ return [
29
+ 'columns' => [
30
+ [
31
+ 'id' => 'type',
32
+ 'label' => 'Type',
33
+ ],
34
+ ],
35
+ ];
36
+ }
37
+
38
+ public function fields(): array
39
+ {
40
+ return [];
41
+ }
42
+ }
@@ -0,0 +1,28 @@
1
+ <?php
2
+
3
+ namespace App\Panneau\Resources\Pages;
4
+
5
+ use Panneau\Support\ResourceType;
6
+ use App\Panneau\Fields\Blocks;
7
+ use App\Panneau\Fields\Page as PageField;
8
+
9
+ class Page extends ResourceType
10
+ {
11
+ public function id(): string
12
+ {
13
+ return 'page';
14
+ }
15
+
16
+ public function name(): string
17
+ {
18
+ return trans('panneau.pages_page');
19
+ }
20
+
21
+ public function fields(): array
22
+ {
23
+ return [
24
+ PageField::make('parent')->withTransLabel('panneau.fields.parent'),
25
+ Blocks::make('blocks')->withTransLabel('panneau.fields.blocks'),
26
+ ];
27
+ }
28
+ }
@@ -0,0 +1,92 @@
1
+ <?php
2
+ namespace App\Panneau\Resources;
3
+
4
+ use App\Panneau\Fields\ImageLocalized;
5
+ use App\Panneau\Fields\PageSlugLocalized;
6
+ use Panneau\Fields\TextLocalized;
7
+ use Panneau\Fields\Toggle;
8
+ use Panneau\Support\Resource;
9
+
10
+ class Pages extends Resource
11
+ {
12
+ public static $repository = \App\Contracts\Repositories\Pages::class;
13
+
14
+ public static $controller = \App\Panneau\Http\Controllers\PagesController::class;
15
+
16
+ public static $jsonResource = \App\Panneau\Http\Resources\PageResource::class;
17
+
18
+ public static $jsonCollection = \App\Panneau\Http\Resources\PagesCollection::class;
19
+
20
+ public static $types = [\App\Panneau\Resources\Pages\Page::class];
21
+
22
+ public static $settings = [
23
+ 'hideInNavbar' => false,
24
+ 'indexIsPaginated' => true,
25
+ 'canCreate' => true,
26
+ ];
27
+
28
+ public function name(): string
29
+ {
30
+ return trans('panneau.pages.name');
31
+ }
32
+
33
+ public function index(): ?array
34
+ {
35
+ return [
36
+ 'columns' => [
37
+ [
38
+ 'label' => trans('panneau.columns.title'),
39
+ 'component' => 'text-localized',
40
+ 'path' => 'title',
41
+ ],
42
+ [
43
+ 'id' => 'type',
44
+ 'label' => 'Type',
45
+ 'component' => 'label',
46
+ 'labels' => $this->getTypes()->mapWithKeys(function ($type) {
47
+ return [
48
+ $type->id() => $type->name(),
49
+ ];
50
+ }),
51
+ ],
52
+ [
53
+ 'id' => 'parent',
54
+ 'label' => trans('panneau.columns.parent_page'),
55
+ 'path' => 'parent.title.fr',
56
+ ],
57
+ 'published',
58
+ [
59
+ 'id' => 'actions',
60
+ 'actions' => ['show', 'edit', 'delete'],
61
+ ],
62
+ ],
63
+ 'filters' => [
64
+ [
65
+ 'name' => 'search',
66
+ 'component' => 'search',
67
+ 'placeholder' => trans('panneau.filters.search'),
68
+ ],
69
+ ],
70
+ ];
71
+ }
72
+
73
+ public function fields(): array
74
+ {
75
+ return [
76
+ Toggle::make('published')
77
+ ->withTransLabel('panneau.fields.published')
78
+ ->hideInForm(),
79
+ TextLocalized::make('title')->withTransLabel('panneau.fields.title'),
80
+ PageSlugLocalized::make('slug')
81
+ ->isDisabled()
82
+ ->withTransLabel('panneau.fields.url'),
83
+ TextLocalized::make('description')
84
+ ->isRequired()
85
+ ->isTextarea()
86
+ ->withTransLabel('panneau.fields.description_short'),
87
+ ImageLocalized::make('image')
88
+ ->withTransLabel('panneau.fields.image')
89
+ ->withButton(),
90
+ ];
91
+ }
92
+ }
@@ -0,0 +1,57 @@
1
+ <?php
2
+
3
+ namespace App\Panneau\Resources;
4
+
5
+ use Panneau\Support\Resource;
6
+ use Panneau\Fields\Text;
7
+ use Panneau\Fields\Email;
8
+ use Panneau\Fields\Password;
9
+ use Panneau\Fields\Select;
10
+
11
+ class Users extends Resource
12
+ {
13
+ public static $repository = \App\Contracts\Repositories\Users::class;
14
+
15
+ public static $controller = \App\Panneau\Http\Controllers\UsersController::class;
16
+
17
+ public static $jsonResource = \App\Panneau\Http\Resources\UserResource::class;
18
+
19
+ public static $jsonCollection = \App\Panneau\Http\Resources\UsersCollection::class;
20
+
21
+ public static $settings = [
22
+ 'hideInNavbar' => false,
23
+ 'indexIsPaginated' => true,
24
+ 'canCreate' => true,
25
+ ];
26
+
27
+ public function name(): string
28
+ {
29
+ return trans('panneau.users.name');
30
+ }
31
+
32
+ public function index(): ?array
33
+ {
34
+ return [
35
+ 'columns' => ['name', 'email', 'role'],
36
+ ];
37
+ }
38
+
39
+ public function fields(): array
40
+ {
41
+ return [
42
+ Text::make('name')->withTransLabel('panneau.fields.name'),
43
+ Email::make('email')->withTransLabel('panneau.fields.email'),
44
+ Password::make('password')->withTransLabel('panneau.fields.password'),
45
+ Select::make('role')
46
+ ->withTransLabel('panneau.fields.role')
47
+ ->withOptions([
48
+ [
49
+ 'value' => 'admin',
50
+ 'label' => trans('panneau.roles.admin'),
51
+ ],
52
+ ])
53
+ ->withoutReset()
54
+ ->withDefaultValue('guest'),
55
+ ];
56
+ }
57
+ }
@@ -0,0 +1,42 @@
1
+ <?php
2
+
3
+ namespace App\Repositories;
4
+
5
+ use Folklore\Repositories\Pages as BasePages;
6
+ use App\Contracts\Repositories\Pages as PagesContract;
7
+ use Folklore\Models\Page as PageBaseModel;
8
+ use App\Models\Page as PageModel;
9
+ use App\Contracts\Resources\Page as PageContract;
10
+
11
+ class Pages extends BasePages implements PagesContract
12
+ {
13
+ protected function newModel(): PageBaseModel
14
+ {
15
+ return new PageModel();
16
+ }
17
+
18
+ public function findById(string $id): ?PageContract
19
+ {
20
+ return parent::findById($id);
21
+ }
22
+
23
+ public function findByHandle(string $handle): ?PageContract
24
+ {
25
+ return parent::findByHandle($handle);
26
+ }
27
+
28
+ public function findBySlug(string $slug, string $locale = null): ?PageContract
29
+ {
30
+ return parent::findBySlug($slug, $locale);
31
+ }
32
+
33
+ public function create(array $data): PageContract
34
+ {
35
+ return parent::create($data);
36
+ }
37
+
38
+ public function update(string $id, array $data): ?PageContract
39
+ {
40
+ return parent::update($id, $data);
41
+ }
42
+ }
@@ -0,0 +1,14 @@
1
+ <?php
2
+
3
+ namespace App\Resources\Pages;
4
+
5
+ use Folklore\Resources\Block;
6
+ use App\Contracts\Resources\Blocks\Text as TextBlockContract;
7
+
8
+ class TextBlock extends Block implements TextBlockContract
9
+ {
10
+ public function body(string $locale): ?string
11
+ {
12
+ return data_get($this->data, 'body.' . $locale);
13
+ }
14
+ }
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ namespace App\Resources;
4
+
5
+ use Folklore\Resources\Page as BasePage;
6
+
7
+ class Page extends BasePage
8
+ {
9
+
10
+ }
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ namespace App\Resources\Pages;
4
+
5
+ use App\Resources\Page;
6
+ use App\Contracts\Resources\Pages\Home as HomePageContract;
7
+
8
+ class HomePage extends Page implements HomePageContract
9
+ {
10
+ }
@@ -0,0 +1,8 @@
1
+ @extends('layout')
2
+
3
+ @section('body')
4
+ <div id="app"></div>
5
+ <script type="text/javascript">
6
+ var props = @json($props);
7
+ </script>
8
+ @endsection
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+
4
+ import shouldPolyfill from './polyfills/should';
5
+
6
+ function getAppProps() {
7
+ return window.props || {};
8
+ }
9
+
10
+ function renderApp(Container, props) {
11
+ const element = document.getElementById('app');
12
+ const container = React.createElement(Container, props);
13
+ const strictMode = React.createElement(React.StrictMode, {}, container);
14
+ const root = createRoot(element);
15
+ root.render(strictMode);
16
+ }
17
+
18
+ function loadContainer({ isPanneau = false }) {
19
+ return isPanneau
20
+ ? import('./components/Panneau')
21
+ : import('./components/Container').then(({ default: Container }) => Container);
22
+ }
23
+
24
+ const props = getAppProps();
25
+
26
+ if (shouldPolyfill()) {
27
+ import('./polyfills/index')
28
+ .then(() => loadContainer(props))
29
+ .then((Container) => renderApp(Container, props));
30
+ } else {
31
+ loadContainer(props).then((Container) => renderApp(Container, props));
32
+ }
@@ -0,0 +1,62 @@
1
+ <?php
2
+ // prettier-ignore
3
+ return [
4
+ 'fields' => [
5
+ 'title' => 'Title',
6
+ 'url' => 'Address',
7
+ 'published' => 'Published',
8
+ 'description_short' => 'Short description',
9
+ 'name' => 'Name',
10
+ 'email' => 'Email',
11
+ 'password' => 'Password',
12
+ 'image' => 'Image',
13
+ 'body' => 'Text',
14
+ 'parent' => 'Parent',
15
+ 'blocks' => 'Blocks',
16
+
17
+ 'page' => 'Page',
18
+ 'pages' => 'Pages',
19
+ 'no_pages' => 'No page',
20
+ 'add_page' => 'Add a page',
21
+ 'select_page' => 'Select a page...',
22
+
23
+ 'item' => 'Item',
24
+ 'items' => 'Items',
25
+ 'no_items' => 'No item',
26
+ 'add_item' => 'Add an item',
27
+ 'select_item' => 'Select an item...',
28
+
29
+ 'block' => 'Block',
30
+ 'blocks' => 'Blocks',
31
+ 'no_blocks' => 'No blocks',
32
+ 'add_block' => 'Add a block',
33
+ ],
34
+
35
+ 'filters' => [
36
+ 'search' => 'Search',
37
+ ],
38
+
39
+ 'columns' => [
40
+ 'title' => 'Title',
41
+ 'parent_page' => 'Parent page',
42
+ ],
43
+
44
+ 'roles' => [
45
+ 'guest' => 'Guest',
46
+ 'admin' => 'Administrator',
47
+ ],
48
+
49
+ 'pages' => [
50
+ 'name' => 'Pages',
51
+ ],
52
+ 'pages_page' => 'Page',
53
+
54
+ 'users' => [
55
+ 'name' => 'Users',
56
+ ],
57
+
58
+ 'blocks' => [
59
+ 'name' => 'Blocks',
60
+ ],
61
+ 'blocks_text' => 'Text',
62
+ ];
@@ -0,0 +1,62 @@
1
+ <?php
2
+ // prettier-ignore
3
+ return [
4
+ 'fields' => [
5
+ 'title' => 'Titre',
6
+ 'url' => 'Adresse',
7
+ 'published' => 'Publié',
8
+ 'description_short' => 'Description courte',
9
+ 'name' => 'Nom',
10
+ 'email' => 'Courriel',
11
+ 'password' => 'Mot de passe',
12
+ 'image' => 'Image',
13
+ 'body' => 'Texte',
14
+ 'parent' => 'Parent',
15
+ 'blocks' => 'Blocs',
16
+
17
+ 'page' => 'Page',
18
+ 'pages' => 'Pages',
19
+ 'no_pages' => 'Aucune page',
20
+ 'add_page' => 'Ajouter une page',
21
+ 'select_page' => 'Sélectionner une page...',
22
+
23
+ 'item' => 'Item',
24
+ 'items' => 'Items',
25
+ 'no_items' => 'Aucun item',
26
+ 'add_item' => 'Ajouter un item',
27
+ 'select_item' => 'Sélectionner un item...',
28
+
29
+ 'block' => 'Bloc',
30
+ 'blocks' => 'Blocs',
31
+ 'no_blocks' => 'Aucun bloc',
32
+ 'add_block' => 'Ajouter un bloc',
33
+ ],
34
+
35
+ 'filters' => [
36
+ 'search' => 'Rechercher',
37
+ ],
38
+
39
+ 'columns' => [
40
+ 'title' => 'Titre',
41
+ 'parent_page' => 'Page parente',
42
+ ],
43
+
44
+ 'roles' => [
45
+ 'guest' => 'Visiteur',
46
+ 'admin' => 'Administrateur',
47
+ ],
48
+
49
+ 'pages' => [
50
+ 'name' => 'Pages',
51
+ ],
52
+ 'pages_page' => 'Page',
53
+
54
+ 'users' => [
55
+ 'name' => 'Utilisateurs',
56
+ ],
57
+
58
+ 'blocks' => [
59
+ 'name' => 'Blocs',
60
+ ],
61
+ 'blocks_text' => 'Texte',
62
+ ];
@@ -4,58 +4,27 @@
4
4
  <head>
5
5
  <meta charset="utf-8">
6
6
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
- <meta name="csrf-token" content="{{ csrf_token() }}">
8
-
9
- <title>@yield('title')</title>
10
- <meta name="description" content="@yield('description')">
11
- <meta name="viewport" content="width=device-width, initial-scale=1">
12
-
13
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-ico">
14
- <link rel="icon" href="/favicon.gif" type="image/gif">
15
- <meta name="csrf-token" content="{{ csrf_token() }}">
16
-
17
- @section('head:scripts')
18
- <!-- Head Javascript -->
19
- <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=WeakMap,Object.values,Object.entries,Intl,Intl.~locale.fr,Intl.~locale.en"></script>
20
- <script type="text/javascript">
21
- var PANNEAU_ASSETS_PATH = '{{ asset('vendor/panneau') }}/';
22
- window._panneau_config=window._panneau_config||{};
23
- function panneau_config(a,b){
24
- if("undefined"===typeof a)return window._panneau_config;
25
- if("undefined"===typeof b)return window._panneau_config[a];
26
- window._panneau_config[a]=b
27
- };
28
- </script>
29
- @stack('scripts:head')
30
- @show
31
-
32
- @section('head:styles')
33
- <link href="{{asset('vendor/panneau/panneau.css')}}?version={{config('app.version')}}" rel="stylesheet" type="text/css" />
34
- @if (app()->environment() === 'production')
35
- <link href="{{asset('panneau/main.css')}}?version={{config('app.version')}}" rel="stylesheet" type="text/css" />
36
- @endif
37
- @stack('styles:head')
38
- @show
39
-
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <meta name="csrf-token" content="{{ csrf_token() }}">
9
+
10
+ <!-- Head Assets -->
11
+ @if(!isset($inWebpack) || !$inWebpack)
12
+ @include('assets_head')
13
+ @endif
14
+ @stack('assets:head')
40
15
  </head>
41
16
  <body>
17
+ <!-- Body -->
42
18
  @section('body')
43
- <div id="panneau"></div>
44
- @show
45
-
46
- @section('body:scripts')
47
- @stack('scripts:footer')
48
- @show
49
-
50
- @section('body:styles')
51
- <script type="text/javascript">
52
- panneau_config('locale', '{{ $locale }}');
53
- panneau_config('messages', {!! json_encode($messages) !!});
54
- panneau_config('definition', {!! json_encode($definition) !!});
55
- </script>
56
- <script src="{{asset('panneau/main.js')}}?version={{config('app.version')}}" type="text/javascript"></script>
57
- @stack('styles:footer')
19
+ @yield('content')
58
20
  @show
59
21
 
22
+ @if(isset($inWebpack) && $inWebpack)
23
+ <script type="text/javascript" src="/static/js/bundle.js"></script>
24
+ <script type="text/javascript" src="/static/js/main.chunk.js"></script>
25
+ @else
26
+ @include('assets_body')
27
+ @endif
28
+ @stack('assets:body')
60
29
  </body>
61
30
  </html>