generator-folklore 3.0.3 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/lib/generators/app/index.js +3 -51
  2. package/lib/generators/babel/index.js +28 -101
  3. package/lib/generators/babel/templates/config.js +16 -0
  4. package/lib/generators/browserslist/index.js +4 -9
  5. package/lib/generators/build/index.js +40 -29
  6. package/lib/generators/cli/index.js +92 -0
  7. package/lib/generators/cli/templates/cli.js +22 -0
  8. package/lib/generators/cli/templates/commands/default.js +16 -0
  9. package/lib/generators/docs/index.js +1 -2
  10. package/lib/generators/editorconfig/index.js +12 -22
  11. package/lib/generators/eslint/index.js +12 -13
  12. package/lib/generators/{html → html-project}/index.js +60 -73
  13. package/lib/generators/{html → html-project}/templates/folklore.png +0 -0
  14. package/lib/generators/{html → html-project}/templates/gitignore +0 -0
  15. package/lib/generators/{html → html-project}/templates/index.html.ejs +4 -1
  16. package/lib/generators/intl/index.js +93 -0
  17. package/lib/generators/laravel/index.js +5 -5
  18. package/lib/generators/laravel-mediatheque/index.js +133 -0
  19. package/lib/generators/laravel-mediatheque/templates/app/Models/Media.php +9 -0
  20. package/lib/generators/laravel-mediatheque/templates/app/Models/MediaFile.php +9 -0
  21. package/lib/generators/laravel-panneau/index.js +49 -28
  22. package/lib/generators/laravel-panneau/templates/app/Contracts/Repositories/Pages.php +19 -0
  23. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Blocks/Text.php +10 -0
  24. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Page.php +10 -0
  25. package/lib/generators/laravel-panneau/templates/app/Contracts/Resources/Pages/Home.php +9 -0
  26. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlockResource.php +37 -0
  27. package/lib/generators/laravel-panneau/templates/app/Http/Resources/BlocksCollection.php +8 -0
  28. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PageResource.php +47 -0
  29. package/lib/generators/laravel-panneau/templates/app/Http/Resources/PagesCollection.php +10 -0
  30. package/lib/generators/laravel-panneau/templates/app/Models/Block.php +3 -13
  31. package/lib/generators/laravel-panneau/templates/app/Models/Page.php +3 -60
  32. package/lib/generators/laravel-panneau/templates/app/Panneau/Composers/AppComposer.php +50 -0
  33. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Block.php +22 -0
  34. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Blocks.php +87 -0
  35. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/Page.php +51 -0
  36. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlug.php +34 -0
  37. package/lib/generators/laravel-panneau/templates/app/Panneau/Fields/PageSlugLocalized.php +18 -0
  38. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/AccountController.php +41 -0
  39. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/Controller.php +19 -0
  40. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/HomeController.php +16 -0
  41. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/PagesController.php +24 -0
  42. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UploadController.php +27 -0
  43. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Controllers/UsersController.php +32 -0
  44. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/AccountUpdateRequest.php +29 -0
  45. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Requests/UploadRequest.php +29 -0
  46. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlockResource.php +39 -0
  47. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/BlocksCollection.php +8 -0
  48. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PageResource.php +56 -0
  49. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/PagesCollection.php +10 -0
  50. package/lib/generators/laravel-panneau/templates/app/Panneau/Http/Resources/UserResource.php +24 -0
  51. package/lib/generators/laravel-panneau/templates/app/Panneau/PanneauServiceProvider.php +48 -0
  52. package/lib/generators/laravel-panneau/templates/app/Panneau/Policies/PanneauPolicy.php +32 -0
  53. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/BlockWithBlocks.php +110 -0
  54. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks/TextBlock.php +27 -0
  55. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Blocks.php +42 -0
  56. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages/Page.php +28 -0
  57. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Pages.php +92 -0
  58. package/lib/generators/laravel-panneau/templates/app/Panneau/Resources/Users.php +57 -0
  59. package/lib/generators/laravel-panneau/templates/app/Repositories/Pages.php +42 -0
  60. package/lib/generators/laravel-panneau/templates/app/Resources/Blocks/TextBlock.php +14 -0
  61. package/lib/generators/laravel-panneau/templates/app/Resources/Page.php +10 -0
  62. package/lib/generators/laravel-panneau/templates/app/Resources/Pages/HomePage.php +10 -0
  63. package/lib/generators/laravel-panneau/templates/app.blade.php +8 -0
  64. package/lib/generators/laravel-panneau/templates/index.js +32 -0
  65. package/lib/generators/laravel-panneau/templates/lang/en/panneau.php +62 -0
  66. package/lib/generators/laravel-panneau/templates/lang/fr/panneau.php +62 -0
  67. package/lib/generators/laravel-panneau/templates/layout.blade.php +17 -48
  68. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/Panneau.jsx +68 -0
  69. package/lib/generators/{js/templates/src/lib/.gitkeep → laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlug.jsx} +0 -0
  70. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/PageSlugLocalized.jsx +43 -0
  71. package/lib/generators/laravel-panneau/templates/resources/assets/js/components/panneau/fields/index.js +2 -0
  72. package/lib/generators/laravel-panneau/templates/resources/assets/styles/panneau.scss +2 -0
  73. package/lib/generators/laravel-panneau/templates/routes.php +30 -0
  74. package/lib/generators/laravel-project/index.js +504 -0
  75. package/lib/generators/laravel-project/templates/env +41 -0
  76. package/lib/generators/laravel-project/templates/laravel/app/Composers/AppComposer.php +48 -0
  77. package/lib/generators/laravel-project/templates/laravel/app/Composers/IntlComposer.php +10 -0
  78. package/lib/generators/laravel-project/templates/laravel/app/Composers/MetaComposer.php +48 -0
  79. package/lib/generators/laravel-project/templates/laravel/app/Composers/RoutesComposer.php +19 -0
  80. package/lib/generators/laravel-project/templates/laravel/app/Contracts/Resources/User.php +10 -0
  81. package/lib/generators/laravel-project/templates/laravel/app/Http/Controllers/HomeController.php +18 -0
  82. package/lib/generators/laravel-project/templates/laravel/app/Http/Middleware/TrustProxies.php +28 -0
  83. package/lib/generators/laravel-project/templates/laravel/app/Http/Resources/UserResource.php +21 -0
  84. package/lib/generators/laravel-project/templates/laravel/app/Models/User.php +50 -0
  85. package/lib/generators/laravel-project/templates/laravel/app/Providers/AppServiceProvider.php +45 -0
  86. package/lib/generators/laravel-project/templates/laravel/app/Providers/RouteServiceProvider.php +64 -0
  87. package/lib/generators/laravel-project/templates/laravel/app/Providers/ViewServiceProvider.php +33 -0
  88. package/lib/generators/laravel-project/templates/laravel/app/Repositories/Users.php +36 -0
  89. package/lib/generators/laravel-project/templates/laravel/app/Resources/User.php +11 -0
  90. package/lib/generators/laravel-project/templates/laravel/config/app.php +216 -0
  91. package/lib/generators/laravel-project/templates/laravel/config/auth.php +116 -0
  92. package/lib/generators/laravel-project/templates/laravel/config/services.php +39 -0
  93. package/lib/generators/laravel-project/templates/laravel/lang/en/content.php +5 -0
  94. package/lib/generators/laravel-project/templates/laravel/lang/en/errors.php +17 -0
  95. package/lib/generators/laravel-project/templates/laravel/lang/en/meta.php +11 -0
  96. package/lib/generators/laravel-project/templates/laravel/lang/en/routes.php +4 -0
  97. package/lib/generators/laravel-project/templates/laravel/lang/fr/auth.php +19 -0
  98. package/lib/generators/laravel-project/templates/laravel/lang/fr/content.php +5 -0
  99. package/lib/generators/laravel-project/templates/laravel/lang/fr/errors.php +17 -0
  100. package/lib/generators/laravel-project/templates/laravel/lang/fr/meta.php +11 -0
  101. package/lib/generators/laravel-project/templates/laravel/lang/fr/pagination.php +19 -0
  102. package/lib/generators/laravel-project/templates/laravel/lang/fr/passwords.php +22 -0
  103. package/lib/generators/laravel-project/templates/laravel/lang/fr/routes.php +12 -0
  104. package/lib/generators/laravel-project/templates/laravel/lang/fr/validation.php +146 -0
  105. package/lib/generators/{js/templates/styles → laravel-project/templates/laravel/resources/assets/fonts}/.gitkeep +0 -0
  106. package/lib/generators/{laravel-panneau/templates/app/Schemas/Fields → laravel-project/templates/laravel/resources/assets/img}/.gitkeep +0 -0
  107. package/lib/generators/laravel-project/templates/laravel/resources/assets/img/folklore.png +0 -0
  108. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/body.blade.php +3 -0
  109. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/gpt.blade.php +16 -0
  110. package/lib/generators/laravel-project/templates/laravel/resources/views/analytics/head.blade.php +1 -0
  111. package/lib/generators/laravel-project/templates/laravel/resources/views/app.blade.php +8 -0
  112. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/401.blade.php +8 -0
  113. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/403.blade.php +8 -0
  114. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/404.blade.php +8 -0
  115. package/lib/generators/laravel-project/templates/laravel/resources/views/errors/500.blade.php +8 -0
  116. package/lib/generators/laravel-project/templates/laravel/resources/views/layout.blade.php +33 -0
  117. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/all.blade.php +4 -0
  118. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/base.blade.php +11 -0
  119. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/facebook.blade.php +4 -0
  120. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/opengraph.blade.php +9 -0
  121. package/lib/generators/laravel-project/templates/laravel/resources/views/meta/twitter.blade.php +5 -0
  122. package/lib/generators/laravel-project/templates/laravel/routes/web.php +12 -0
  123. package/lib/generators/lerna-package/index.js +1 -3
  124. package/lib/generators/lerna-repository/index.js +1 -3
  125. package/lib/generators/node-project/index.js +164 -0
  126. package/lib/generators/node-project/templates/index.js +0 -0
  127. package/lib/generators/npm-package/index.js +3 -5
  128. package/lib/generators/prettier/index.js +19 -6
  129. package/lib/generators/prettier/templates/prettierrc.json +3 -1
  130. package/lib/generators/{js → react-app}/index.js +22 -52
  131. package/lib/generators/{js → react-app}/templates/_package.json +0 -0
  132. package/lib/generators/react-app/templates/index.js +23 -0
  133. package/lib/generators/react-app/templates/src/components/App.jsx +46 -0
  134. package/lib/generators/react-app/templates/src/components/Container.jsx +40 -0
  135. package/lib/generators/{js → react-app}/templates/src/components/buttons/Button.jsx +4 -18
  136. package/lib/generators/react-app/templates/src/components/layouts/Main.jsx +27 -0
  137. package/lib/generators/react-app/templates/src/components/menus/Menu.jsx +62 -0
  138. package/lib/generators/{js → react-app}/templates/src/components/pages/Error.jsx +10 -14
  139. package/lib/generators/react-app/templates/src/components/pages/Home.jsx +32 -0
  140. package/lib/generators/{js → react-app}/templates/src/components/partials/PageMeta.jsx +11 -11
  141. package/lib/generators/{js → react-app}/templates/src/contexts/KeysContext.jsx +0 -0
  142. package/lib/generators/react-app/templates/src/lib/.gitkeep +0 -0
  143. package/lib/generators/{js → react-app}/templates/src/lib/PropTypes.js +0 -0
  144. package/lib/generators/{js → react-app}/templates/src/lib/utils.js +0 -0
  145. package/lib/generators/react-app/templates/src/polyfills/index.js +6 -0
  146. package/lib/generators/react-app/templates/src/polyfills/intl-en.js +2 -0
  147. package/lib/generators/react-app/templates/src/polyfills/intl-fr.js +2 -0
  148. package/lib/generators/react-app/templates/src/polyfills/should.js +14 -0
  149. package/lib/generators/react-app/templates/styles/.gitkeep +0 -0
  150. package/lib/generators/{js/templates/styles/buttons/button.scss → react-app/templates/styles/buttons/button.module.scss} +1 -0
  151. package/lib/generators/{js/templates/styles/layouts/main.scss → react-app/templates/styles/layouts/main.module.scss} +0 -0
  152. package/lib/generators/{js/templates/styles/menus/menu.scss → react-app/templates/styles/menus/menu.module.scss} +0 -0
  153. package/lib/generators/{js/templates/styles/pages/error.scss → react-app/templates/styles/pages/error.module.scss} +0 -0
  154. package/lib/generators/{js/templates/styles/pages/home.scss → react-app/templates/styles/pages/home.module.scss} +0 -0
  155. package/lib/generators/rollup/index.js +54 -0
  156. package/lib/generators/rollup/templates/config.js +50 -0
  157. package/lib/generators/scss/index.js +3 -16
  158. package/lib/generators/scss/templates/{main.scss → styles.scss} +0 -0
  159. package/lib/generators/server/index.js +81 -0
  160. package/lib/generators/server/templates/server.js +59 -0
  161. package/lib/generators/storybook/index.js +1 -7
  162. package/lib/generators/stylelint/index.js +13 -14
  163. package/lib/lib/generator.js +9 -0
  164. package/lib/lib/utils.js +17 -0
  165. package/package.json +2 -2
  166. package/lib/generators/babel/templates/babel-preset-react.js +0 -7
  167. package/lib/generators/babel/templates/babel-preset.js +0 -57
  168. package/lib/generators/babel/templates/babelrc +0 -5
  169. package/lib/generators/babel/templates/utils/processScss.js +0 -10
  170. package/lib/generators/babel/templates/utils/transformRequireIgnore.js +0 -80
  171. package/lib/generators/html/templates/index.js +0 -9
  172. package/lib/generators/html/templates/root.js +0 -23
  173. package/lib/generators/html/templates/utils.js +0 -7
  174. package/lib/generators/js/templates/browserslistrc +0 -9
  175. package/lib/generators/js/templates/config.js +0 -33
  176. package/lib/generators/js/templates/index.js +0 -41
  177. package/lib/generators/js/templates/src/actions/LayoutActions.js +0 -12
  178. package/lib/generators/js/templates/src/actions/SiteActions.js +0 -22
  179. package/lib/generators/js/templates/src/components/App.jsx +0 -52
  180. package/lib/generators/js/templates/src/components/Root.jsx +0 -70
  181. package/lib/generators/js/templates/src/components/layouts/Main.jsx +0 -52
  182. package/lib/generators/js/templates/src/components/menus/Menu.jsx +0 -60
  183. package/lib/generators/js/templates/src/components/messages/Success.jsx +0 -36
  184. package/lib/generators/js/templates/src/components/pages/Home.jsx +0 -32
  185. package/lib/generators/js/templates/src/components/partials/Label.jsx +0 -32
  186. package/lib/generators/js/templates/src/reducers/LayoutReducer.js +0 -32
  187. package/lib/generators/js/templates/src/reducers/SiteReducer.js +0 -36
  188. package/lib/generators/js/templates/src/reducers/index.js +0 -7
  189. package/lib/generators/js/templates/src/vendor/polyfills/intl-en.js +0 -2
  190. package/lib/generators/js/templates/src/vendor/polyfills/intl-fr.js +0 -2
  191. package/lib/generators/laravel-panneau/templates/_composer.json +0 -6
  192. package/lib/generators/laravel-panneau/templates/_package.json +0 -11
  193. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/HomeController.php +0 -14
  194. package/lib/generators/laravel-panneau/templates/app/Http/Controllers/Panneau/PagesController.php +0 -11
  195. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/File.php +0 -13
  196. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Picture.php +0 -13
  197. package/lib/generators/laravel-panneau/templates/app/Models/Mediatheque/Video.php +0 -34
  198. package/lib/generators/laravel-panneau/templates/app/Providers/PanneauServiceProvider.php +0 -23
  199. package/lib/generators/laravel-panneau/templates/app/Reducers/SlugExtractReducer.php +0 -18
  200. package/lib/generators/laravel-panneau/templates/app/Resources/Pages.php +0 -54
  201. package/lib/generators/laravel-panneau/templates/app/Schemas/Blocks/Base.php +0 -22
  202. package/lib/generators/laravel-panneau/templates/app/Schemas/Bubbles/Base.php +0 -22
  203. package/lib/generators/laravel-panneau/templates/app/Schemas/Pages/Base.php +0 -36
  204. package/lib/generators/laravel-panneau/templates/resources/lang/en/panneau.php +0 -12
  205. package/lib/generators/laravel-panneau/templates/resources/lang/fr/panneau.php +0 -12
@@ -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>
@@ -0,0 +1,68 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Panneau from '@panneau/app';
4
+ import { getCSRFHeaders } from '@folklore/fetch';
5
+
6
+ import { FIELDS_NAMESPACE } from '@panneau/core/contexts';
7
+ import * as fieldsComponents from './panneau/fields';
8
+ import * as AppPropTypes from '../lib/PropTypes';
9
+
10
+ import '../../styles/panneau.scss';
11
+
12
+ const propTypes = {
13
+ definition: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
14
+ baseUrl: PropTypes.string.isRequired,
15
+ uploadEndpoint: PropTypes.string,
16
+ user: AppPropTypes.user,
17
+ statusCode: AppPropTypes.statusCode,
18
+ };
19
+
20
+ const defaultProps = {
21
+ user: null,
22
+ uploadEndpoint: '/panneau/upload',
23
+ statusCode: null,
24
+ };
25
+
26
+ const PanneauContainer = ({ definition, user, baseUrl, uploadEndpoint, statusCode }) => {
27
+ const { routes = {} } = definition;
28
+ const isAuthorized = statusCode !== 401 && statusCode !== 403;
29
+
30
+ const [localeLoaded, setLocaleLoaded] = useState(false);
31
+
32
+ useEffect(() => {
33
+ let canceled = false;
34
+ import(`@panneau/intl/locale/${definition.intl.locale}`).then(() => {
35
+ if (!canceled) {
36
+ setLocaleLoaded(true);
37
+ }
38
+ });
39
+ return () => {
40
+ canceled = true;
41
+ };
42
+ }, [definition]);
43
+
44
+ return localeLoaded ? (
45
+ <Panneau
46
+ definition={definition}
47
+ routes={routes}
48
+ user={isAuthorized ? user : null}
49
+ baseUrl={baseUrl}
50
+ uppy={{
51
+ transport: 'xhr',
52
+ xhr: {
53
+ endpoint: uploadEndpoint,
54
+ headers: getCSRFHeaders(),
55
+ timeout: 0,
56
+ },
57
+ }}
58
+ components={{
59
+ [FIELDS_NAMESPACE]: fieldsComponents,
60
+ }}
61
+ />
62
+ ) : null;
63
+ };
64
+
65
+ PanneauContainer.propTypes = propTypes;
66
+ PanneauContainer.defaultProps = defaultProps;
67
+
68
+ export default PanneauContainer;
@@ -0,0 +1,43 @@
1
+ /* eslint-disable react/jsx-props-no-spreading */
2
+ import React, { useMemo } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import get from 'lodash/get';
5
+ import isEmpty from 'lodash/isEmpty';
6
+ import slugify from 'slugify';
7
+ import LocalizedField from '@panneau/field-localized';
8
+ import { useFormValue } from '@panneau/core/contexts';
9
+
10
+ const propTypes = {
11
+ value: PropTypes.objectOf(PropTypes.string),
12
+ locales: PropTypes.arrayOf(PropTypes.string),
13
+ };
14
+
15
+ const defaultProps = {
16
+ value: null,
17
+ locales: null,
18
+ };
19
+
20
+ const PageSlugField = ({ value, locales, ...props }) => {
21
+ const page = useFormValue();
22
+ const { title = null } = page || {};
23
+ const finalValue = useMemo(
24
+ () =>
25
+ locales.reduce(
26
+ (newValue, key) =>
27
+ newValue === null || isEmpty(newValue[key])
28
+ ? {
29
+ ...newValue,
30
+ [key]: slugify(get(title, key, '')),
31
+ }
32
+ : newValue,
33
+ value,
34
+ ),
35
+ [locales, value, title],
36
+ );
37
+ return <LocalizedField value={finalValue} locales={locales} {...props} />;
38
+ };
39
+
40
+ PageSlugField.propTypes = propTypes;
41
+ PageSlugField.defaultProps = defaultProps;
42
+
43
+ export default PageSlugField;
@@ -0,0 +1,2 @@
1
+ export { default as PageSlug } from './PageSlug'
2
+ export { default as PageSlugLocalized } from './PageSlugLocalized'
@@ -0,0 +1,2 @@
1
+ @import '~@panneau/themes/scss/styles';
2
+ @import '~@panneau/themes/scss/vendor';
@@ -0,0 +1,30 @@
1
+ <?php
2
+
3
+ use Illuminate\Support\Facades\Route;
4
+ use Panneau\Support\Facade as Panneau;
5
+
6
+ Panneau::router()->group(function () {
7
+ $namePrefix = config('panneau.routes.name_prefix', config('panneau.routes.prefix') . '.');
8
+
9
+ Route::any('tus/{any?}', function () {
10
+ return app('tus-server')->serve();
11
+ })->where('any', '.*');
12
+
13
+ Panneau::router()->auth();
14
+
15
+ Route::namespace('\App\Panneau\Http\Controllers')
16
+ ->middleware(['web', 'auth', 'can:view,' . \Panneau\Panneau::class])
17
+ ->group(function () use ($namePrefix) {
18
+ Route::get('/', 'HomeController@index')->name($namePrefix . 'home');
19
+
20
+ Route::post('upload', 'UploadController@upload')->name($namePrefix . 'upload');
21
+
22
+ // Account
23
+ Route::get('account', 'AccountController@index')->name($namePrefix . 'account');
24
+ Route::post('account', 'AccountController@update')->name(
25
+ $namePrefix . 'account.update'
26
+ );
27
+
28
+ Panneau::router()->resources();
29
+ });
30
+ });