pageflow 15.2.2 → 15.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -118
  3. data/README.md +2 -3
  4. data/admins/pageflow/accounts.rb +1 -98
  5. data/admins/pageflow/entry.rb +21 -1
  6. data/admins/pageflow/entry_templates.rb +140 -0
  7. data/admins/pageflow/membership.rb +12 -0
  8. data/admins/pageflow/user.rb +5 -5
  9. data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
  10. data/app/assets/javascripts/pageflow/admin/users.js +1 -1
  11. data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
  12. data/app/assets/javascripts/pageflow/base.js +0 -12
  13. data/app/assets/javascripts/pageflow/components.js +2 -6
  14. data/app/assets/javascripts/pageflow/dist/ui.js +178 -55
  15. data/app/assets/javascripts/pageflow/editor/vendor.js +1 -0
  16. data/app/assets/javascripts/pageflow/vendor.js +12 -10
  17. data/app/assets/stylesheets/pageflow/base.scss +0 -7
  18. data/app/assets/stylesheets/pageflow/editor/base.scss +5 -2
  19. data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
  20. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
  21. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
  22. data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
  23. data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
  24. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
  25. data/app/assets/stylesheets/pageflow/entries.scss +1 -1
  26. data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
  27. data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
  28. data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
  29. data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +1 -1
  30. data/app/assets/stylesheets/pageflow/themes/default/page.scss +7 -0
  31. data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
  32. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
  33. data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
  34. data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
  35. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
  36. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
  37. data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
  38. data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
  39. data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
  40. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
  41. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
  42. data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
  43. data/app/helpers/pageflow/structured_data_helper.rb +0 -2
  44. data/app/models/pageflow/account.rb +21 -1
  45. data/app/models/pageflow/account_role_query.rb +1 -1
  46. data/app/models/pageflow/chapter.rb +3 -9
  47. data/app/models/pageflow/entry.rb +9 -2
  48. data/app/models/pageflow/entry_duplicate.rb +1 -0
  49. data/app/models/pageflow/entry_template.rb +16 -2
  50. data/app/models/pageflow/managed_user_query.rb +1 -1
  51. data/app/models/pageflow/page.rb +1 -4
  52. data/app/models/pageflow/revision.rb +0 -4
  53. data/app/models/pageflow/storyline.rb +2 -9
  54. data/app/policies/pageflow/account_policy.rb +10 -0
  55. data/app/policies/pageflow/entry_template_policy.rb +5 -1
  56. data/app/policies/pageflow/folder_policy.rb +2 -2
  57. data/app/policies/pageflow/membership_policy.rb +2 -2
  58. data/app/policies/pageflow/theming_policy.rb +2 -2
  59. data/app/policies/pageflow/user_policy.rb +1 -1
  60. data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
  61. data/app/views/admin/accounts/_form.html.erb +3 -49
  62. data/app/views/admin/entries/_attributes_table.html.arb +5 -0
  63. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
  64. data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
  65. data/app/views/admin/entry_templates/_form.html.erb +58 -0
  66. data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
  67. data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
  68. data/app/views/pageflow/admin/initial_passwords/edit.html.erb +2 -1
  69. data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
  70. data/app/views/pageflow/themes/_theme.json.jbuilder +1 -1
  71. data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
  72. data/config/initializers/admin_resource_tabs.rb +5 -0
  73. data/config/initializers/help_entries.rb +1 -5
  74. data/config/initializers/revision_components.rb +5 -0
  75. data/config/locales/de.yml +88 -155
  76. data/config/locales/en.yml +79 -143
  77. data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
  78. data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
  79. data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
  80. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1528 -1349
  81. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9258 -0
  82. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
  83. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
  84. data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
  85. data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
  86. data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +9 -0
  87. data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
  88. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
  89. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
  90. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
  91. data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
  92. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +3 -3
  93. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +4 -2
  94. data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
  95. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
  96. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
  97. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
  98. data/entry_types/paged/config/initializers/features.rb +1 -1
  99. data/entry_types/paged/config/initializers/help_entries.rb +17 -0
  100. data/entry_types/paged/config/locales/new/help.de.yml +162 -0
  101. data/entry_types/paged/config/locales/new/help.en.yml +153 -0
  102. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
  103. data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
  104. data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
  105. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
  106. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
  107. data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
  108. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
  109. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
  110. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
  111. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
  112. data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
  113. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
  114. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
  115. data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
  116. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  117. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
  118. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
  119. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
  120. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +7 -0
  121. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
  122. data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
  123. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +40 -0
  124. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +36 -0
  125. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +3 -9
  126. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +37 -2
  127. data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +3 -9
  128. data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +1 -9
  129. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
  130. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
  131. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/_global_notices.html.erb +10 -0
  132. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +28 -11
  133. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
  134. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +8 -0
  135. data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
  136. data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
  137. data/entry_types/scrolled/config/locales/de.yml +669 -0
  138. data/entry_types/scrolled/config/locales/en.yml +488 -0
  139. data/entry_types/scrolled/config/routes.rb +1 -0
  140. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +76 -6
  141. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
  142. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
  143. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
  144. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
  145. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
  146. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
  147. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
  148. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
  149. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
  150. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
  151. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
  152. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
  153. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
  154. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -0
  155. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +6 -0
  156. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
  157. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
  158. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +33 -0
  159. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +8 -0
  160. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +173 -0
  161. data/entry_types/scrolled/package/config/webpack.js +11 -0
  162. data/entry_types/scrolled/package/contentElements-editor.js +316 -185
  163. data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
  164. data/entry_types/scrolled/package/contentElements-frontend.js +940 -304
  165. data/entry_types/scrolled/package/editor.js +2930 -371
  166. data/entry_types/scrolled/package/frontend-server.js +228 -0
  167. data/entry_types/scrolled/package/frontend/EditableText-7093fd0e.js +1071 -0
  168. data/entry_types/scrolled/package/frontend/Viewer-e49e7807.js +387 -0
  169. data/entry_types/scrolled/package/frontend/Wavesurfer-0adf5667.js +375 -0
  170. data/entry_types/scrolled/package/frontend/components-6a6793ca.js +2534 -0
  171. data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
  172. data/entry_types/scrolled/package/frontend/i18n-4dc6c377.js +1092 -0
  173. data/entry_types/scrolled/package/frontend/index.css +9 -0
  174. data/entry_types/scrolled/package/frontend/index.js +5686 -0
  175. data/entry_types/scrolled/package/frontend/useBrowserFeature-91a4c29d.js +33 -0
  176. data/entry_types/scrolled/package/package.json +30 -9
  177. data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
  178. data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
  179. data/lib/generators/pageflow/initializer/templates/pageflow.rb +14 -9
  180. data/lib/pageflow/ability_mixin.rb +14 -2
  181. data/lib/pageflow/configuration.rb +6 -5
  182. data/lib/pageflow/entry_export_import/revision_serialization.rb +15 -13
  183. data/lib/pageflow/entry_export_import/revision_serialization/import.rb +18 -26
  184. data/lib/pageflow/entry_type_configuration.rb +2 -0
  185. data/lib/pageflow/global_config_api.rb +5 -4
  186. data/lib/pageflow/nested_revision_component.rb +49 -0
  187. data/lib/pageflow/react.rb +4 -2
  188. data/lib/pageflow/revision_component.rb +6 -2
  189. data/lib/pageflow/themes.rb +4 -0
  190. data/lib/pageflow/user_mixin.rb +2 -1
  191. data/lib/pageflow/version.rb +1 -1
  192. data/{packages/pageflow → package}/config/jest/index.js +8 -2
  193. data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
  194. data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
  195. data/{packages/pageflow → package}/config/webpack.js +7 -0
  196. data/{packages/pageflow → package}/editor.js +482 -1130
  197. data/package/frontend.js +2553 -0
  198. data/{packages/pageflow → package}/package.json +3 -0
  199. data/{packages/pageflow → package}/testHelpers.js +114 -13
  200. data/{packages/pageflow → package}/ui.js +178 -55
  201. data/spec/factories/accounts.rb +3 -1
  202. data/spec/factories/entry_templates.rb +1 -0
  203. data/spec/factories/published_entries.rb +6 -1
  204. data/spec/factories/test_revision_components.rb +4 -0
  205. metadata +95 -36
  206. data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
  207. data/app/assets/javascripts/pageflow/videojs.js +0 -6
  208. data/config/initializers/entry_types.rb +0 -4
  209. data/entry_types/scrolled/config/locales/new/de.yml +0 -269
  210. data/entry_types/scrolled/config/locales/new/en.yml +0 -264
  211. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +0 -96
  212. data/entry_types/scrolled/package/frontend.js +0 -2879
  213. data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
@@ -0,0 +1,33 @@
1
+ import { browser } from 'pageflow/frontend';
2
+ import React, { createContext, useContext, useState, useEffect } from 'react';
3
+ import { _ as _slicedToArray } from './i18n-4dc6c377.js';
4
+
5
+ var BrowserFeaturesAvailableContext = createContext(); // Browser feature detection is not available during server side
6
+ // rendering. To prevent mismatches during hydration, we keep features
7
+ // disabled in the initial render. Since hydration only starts after
8
+ // feature detection has finished, we can immediately re-render once
9
+ // the provider has mounted.
10
+
11
+ function BrowserFeaturesProvider(_ref) {
12
+ var children = _ref.children;
13
+
14
+ var _useState = useState(false),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ isAvailable = _useState2[0],
17
+ setIsAvailable = _useState2[1];
18
+
19
+ useEffect(function () {
20
+ return setIsAvailable(true);
21
+ }, []);
22
+ return (
23
+ /*#__PURE__*/
24
+ React.createElement(BrowserFeaturesAvailableContext.Provider, {
25
+ value: isAvailable
26
+ }, children)
27
+ );
28
+ }
29
+ function useBrowserFeature(name) {
30
+ return useContext(BrowserFeaturesAvailableContext) && browser.has(name);
31
+ }
32
+
33
+ export { BrowserFeaturesProvider as B, useBrowserFeature as u };
@@ -7,22 +7,43 @@
7
7
  "author": "Codevise Solutions GmbH <info@codevise.de>",
8
8
  "license": "MIT",
9
9
  "dependencies": {
10
+ "@egjs/view360": "^3.4.3",
11
+ "core-js": "^3.6.5",
12
+ "debounce": "^1.2.0",
13
+ "deep-assign": "^3.0.0",
14
+ "intersection-observer": "^0.7.0",
15
+ "invert-color": "^2.0.0",
10
16
  "prop-types": "^15.7.2",
11
- "react": "^16.9.0",
12
- "react-dom": "^16.9.0",
17
+ "react-compare-image": "https://github.com/codevise/react-compare-image#offset-width-fix",
18
+ "react-dnd": "^11.1.3",
19
+ "react-dnd-html5-backend": "^11.1.3",
20
+ "react-draggable": "^4.4.2",
21
+ "react-measure": "^2.3.0",
13
22
  "react-player": "^1.15.2",
14
23
  "react-tooltip": "^3.11.1",
15
- "react-compare-image": "^2.0.4"
24
+ "react_ujs": "^2.6.1",
25
+ "reselect": "^4.0.0",
26
+ "screenfull": "^5.1.0",
27
+ "slate": "^0.57.3",
28
+ "slate-react": "^0.57.3",
29
+ "slugify": "^1.4.6",
30
+ "striptags": "^3.1.1",
31
+ "use-context-selector": "^1.2.11",
32
+ "video.js": "https://github.com/tf/video.js#pageflow-scrolled-5",
33
+ "wavesurfer.js": "https://github.com/tf/wavesurfer.js#patches",
34
+ "whatwg-fetch": "^3.0.0"
16
35
  },
17
36
  "peerDependencies": {
18
- "pageflow": "15.1.0"
37
+ "pageflow": "15.1.0",
38
+ "react": "^16.9.0",
39
+ "react-dom": "^16.9.0"
19
40
  },
20
41
  "devDependencies": {
21
42
  "@percy/storybook": "^3.2.0",
22
43
  "@storybook/addon-viewport": "^5.3.13",
23
44
  "@storybook/react": "^5.3.9",
24
45
  "@testing-library/jest-dom": "^4.2.4",
25
- "@testing-library/react": "^9.4.0",
46
+ "@testing-library/react": "^10.3.0",
26
47
  "@testing-library/react-hooks": "^3.2.1",
27
48
  "@typescript-eslint/eslint-plugin": "2.x",
28
49
  "@typescript-eslint/parser": "2.x",
@@ -39,15 +60,15 @@
39
60
  "eslint-plugin-react": "7.x",
40
61
  "eslint-plugin-react-hooks": "1.x",
41
62
  "jest": "^24.9.0",
42
- "jest-css-modules-transform": "^3.1.0",
43
63
  "jest-svg-transformer": "^1.0.0",
64
+ "react-svg-loader": "^3.0.3",
44
65
  "react-test-renderer": "^16.9.0"
45
66
  },
46
67
  "scripts": {
47
68
  "test": "jest",
48
69
  "lint": "eslint .",
49
- "start-storybook": "start-storybook",
50
- "build-storybook": "build-storybook -o .storybook/out",
51
- "snapshot": "STORYBOOK_SPLIT=true build-storybook --quiet -o .storybook/out && PERCY_TOKEN=${PERCY_TOKEN:-$PT} percy-storybook --widths=1280 --build_dir=.storybook/out"
70
+ "start-storybook": "start-storybook -s .storybook/static",
71
+ "build-storybook": "build-storybook -s .storybook/static -o .storybook/out",
72
+ "snapshot": "STORYBOOK_SPLIT=true build-storybook --quiet -s .storybook/static -o .storybook/out && PERCY_TOKEN=${PERCY_TOKEN:-$PT} percy-storybook --widths=1280 --build_dir=.storybook/out"
52
73
  }
53
74
  }
@@ -3,19 +3,24 @@ Pageflow.configure do |config|
3
3
  # users.
4
4
  config.mailer_sender = 'change-me-at-config-initializers-pageflow@example.com'
5
5
 
6
- # Plugins provide page types and widget types.
6
+ # Entry type plugins
7
+ config.plugin(PageflowPaged.plugin)
8
+
9
+ # Plugins that provide page types and widget types.
7
10
  config.plugin(Pageflow.built_in_page_types_plugin)
8
11
  config.plugin(Pageflow.built_in_widget_types_plugin)
9
12
  # config.plugin(Pageflow::Rainbow.plugin)
10
13
 
11
- # Add custom themes by invoking the pageflow:theme generator and
12
- # registering the theme here.
13
- #
14
- # $ rails generate pageflow:theme my_custom_theme
15
- # => creates app/assets/stylesheets/pageflow/themes/my_custom_theme.css.scss
16
- #
17
- config.themes.register(:default)
18
- # config.themes.register(:my_custom_theme)
14
+ config.for_entry_type(PageflowPaged.entry_type) do |entry_type_config|
15
+ # Add custom themes by invoking the pageflow:theme generator and
16
+ # registering the theme here.
17
+ #
18
+ # $ rails generate pageflow:theme my_custom_theme
19
+ # => creates app/assets/stylesheets/pageflow/themes/my_custom_theme.css.scss
20
+ #
21
+ entry_type_config.themes.register(:default)
22
+ # config.themes.register(:my_custom_theme)
23
+ end
19
24
 
20
25
  # String to interpolate into paths of files generated by paperclip
21
26
  # preprocessors. This allows to refresh cdn caches after
@@ -23,6 +23,10 @@ module Pageflow
23
23
  AccountPolicy.new(user, account).add_member_to?
24
24
  end
25
25
 
26
+ can :see_user_quota, Account do |account|
27
+ AccountPolicy.new(user, account).see_user_quota?
28
+ end
29
+
26
30
  can :see_badge_belonging_to, Account do |account|
27
31
  AccountPolicy.new(user, account).see_badge_belonging_to?
28
32
  end
@@ -95,6 +99,10 @@ module Pageflow
95
99
  Admin::AdminOnlyTabPolicy.new(user, tab).see?
96
100
  end
97
101
 
102
+ can :see_entry_types, Account do |account|
103
+ AccountPolicy.new(user, account).see_entry_types?
104
+ end
105
+
98
106
  unless user.admin?
99
107
  can :configure_folder_on, Account do |account|
100
108
  AccountPolicy.new(user, account).configure_folder_on?
@@ -214,8 +222,12 @@ module Pageflow
214
222
  ThemingPolicy.new(user, theming).edit?
215
223
  end
216
224
 
217
- can :edit, EntryTemplate do |entry_template|
218
- EntryTemplatePolicy.new(user, entry_template).edit?
225
+ can :create, EntryTemplate do |entry_template|
226
+ EntryTemplatePolicy.new(user, entry_template).create?
227
+ end
228
+
229
+ can :update, EntryTemplate do |entry_template|
230
+ EntryTemplatePolicy.new(user, entry_template).update?
219
231
  end
220
232
 
221
233
  can :create, ::User do |managed_user|
@@ -500,13 +500,14 @@ module Pageflow
500
500
  # Restricts the configuration interface to those parts which can
501
501
  # be used from inside features.
502
502
  FeatureLevelConfiguration = Struct.new(:config) do
503
- delegate :page_types, to: :config
504
- delegate :widget_types, to: :config
505
- delegate :help_entries, to: :config
506
- delegate :admin_form_inputs, to: :config
507
503
  delegate :admin_attributes_table_rows, to: :config
508
- delegate :themes, to: :config
504
+ delegate :admin_form_inputs, to: :config
505
+ delegate :entry_types, to: :config
509
506
  delegate :file_importers, to: :config
507
+ delegate :help_entries, to: :config
508
+ delegate :page_types, to: :config
509
+ delegate :themes, to: :config
510
+ delegate :widget_types, to: :config
510
511
 
511
512
  delegate :for_entry_type, to: :config
512
513
  end
@@ -10,19 +10,6 @@ module Pageflow
10
10
  widgets: {
11
11
  except: [:subject_id, :subject_type]
12
12
  },
13
- storylines: {
14
- except: :revision_id,
15
- include: {
16
- chapters: {
17
- except: :storyline_id,
18
- include: {
19
- pages: {
20
- except: :chapter_id
21
- }
22
- }
23
- }
24
- }
25
- },
26
13
  file_usages: {
27
14
  except: [:revision_id],
28
15
  include: {
@@ -51,6 +38,21 @@ module Pageflow
51
38
  revision_component
52
39
  .attributes.except('revision_id')
53
40
  .merge('class_name' => revision_component.class.name)
41
+ .merge('components' => serialize_nested_revision_components(revision_component))
42
+ end
43
+ end
44
+
45
+ def serialize_nested_revision_components(revision_component)
46
+ collection_names = revision_component.nested_revision_component_collection_names
47
+
48
+ collection_names.each_with_object({}) do |collection_name, result|
49
+ collection = revision_component.send(collection_name)
50
+
51
+ result[collection_name] = collection.map do |nested_component|
52
+ nested_component
53
+ .attributes
54
+ .merge('components' => serialize_nested_revision_components(nested_component))
55
+ end
54
56
  end
55
57
  end
56
58
  end
@@ -17,7 +17,6 @@ module Pageflow
17
17
  Revision.transaction do
18
18
  revision = create_revision(data)
19
19
 
20
- create_storylines_chapters_and_pages(revision, data['storylines'])
21
20
  create_widgets(revision, data['widgets'])
22
21
  create_revision_components(revision, data['components'])
23
22
  create_files(revision, data['file_usages'])
@@ -46,30 +45,6 @@ module Pageflow
46
45
  end
47
46
  end
48
47
 
49
- def create_storylines_chapters_and_pages(revision, storylines_data)
50
- storylines_data.each do |storyline_data|
51
- chapters_data = storyline_data.delete('chapters')
52
- storyline = revision.storylines.create!(storyline_data.except(*DEFAULT_REMOVAL_COLUMNS))
53
-
54
- create_chapters_and_pages(storyline, chapters_data)
55
- end
56
- end
57
-
58
- def create_chapters_and_pages(storyline, chapters_data)
59
- chapters_data.each do |chapter_data|
60
- pages_data = chapter_data.delete('pages')
61
- chapter = storyline.chapters.create!(chapter_data.except(*DEFAULT_REMOVAL_COLUMNS))
62
-
63
- create_pages(chapter, pages_data)
64
- end
65
- end
66
-
67
- def create_pages(chapter, pages_data)
68
- pages_data.each do |page_data|
69
- chapter.pages.create!(page_data.except(*DEFAULT_REMOVAL_COLUMNS))
70
- end
71
- end
72
-
73
48
  def create_widgets(revision, widgets_data)
74
49
  widgets_data.each do |widget_data|
75
50
  revision.widgets.create!(widget_data.except(*DEFAULT_REMOVAL_COLUMNS))
@@ -78,9 +53,26 @@ module Pageflow
78
53
 
79
54
  def create_revision_components(revision, revision_components_data)
80
55
  revision_components_data.each do |component_data|
56
+ nested_compontents_data = component_data.delete('components')
57
+
81
58
  component_model = component_data.delete('class_name').constantize
82
59
  component_data['revision_id'] = revision.id
83
- component_model.create!(component_data.except(*DEFAULT_REMOVAL_COLUMNS))
60
+ component = component_model.create!(component_data.except(*DEFAULT_REMOVAL_COLUMNS))
61
+
62
+ create_nested_revision_components(component, nested_compontents_data)
63
+ end
64
+ end
65
+
66
+ def create_nested_revision_components(revision_component, nested_compontents_data)
67
+ nested_compontents_data.each do |collection_name, components_data|
68
+ components_data.each do |component_data|
69
+ nested_compontents_data = component_data.delete('components')
70
+
71
+ collection = revision_component.send(collection_name)
72
+ nested_component = collection.create!(component_data.except(*DEFAULT_REMOVAL_COLUMNS))
73
+
74
+ create_nested_revision_components(nested_component, nested_compontents_data)
75
+ end
84
76
  end
85
77
  end
86
78
 
@@ -11,10 +11,12 @@ module Pageflow
11
11
 
12
12
  attr_reader :features
13
13
 
14
+ delegate :file_importers, to: :@config
14
15
  delegate :file_types, to: :@config
15
16
  delegate :help_entries, to: :@config
16
17
  delegate :hooks, to: :@config
17
18
  delegate :revision_components, to: :@config
19
+ delegate :themes, to: :@config
18
20
  delegate :widget_types, to: :@config
19
21
 
20
22
  def plugin(plugin)
@@ -44,13 +44,14 @@ module Pageflow
44
44
  # @return [Configuration]
45
45
  # @since 0.9
46
46
  def config_for(target)
47
- config = build_config(target.respond_to?(:type_name) && target.type_name) do |c|
47
+ config = build_config(
48
+ target.respond_to?(:entry_type) && target.entry_type.name
49
+ ) do |c|
48
50
  c.enable_features(target.enabled_feature_names(c))
49
51
  end
50
52
 
51
- if target.respond_to?(:type_name)
52
- config = Configuration::ConfigView.new(config,
53
- config.entry_types.find_by_name!(target.type_name))
53
+ if target.respond_to?(:entry_type)
54
+ config = Configuration::ConfigView.new(config, target.entry_type)
54
55
  end
55
56
 
56
57
  config
@@ -0,0 +1,49 @@
1
+ module Pageflow
2
+ # Include in models that are declared as nested revision components
3
+ # of other revision components.
4
+ #
5
+ # @since 15.5
6
+ module NestedRevisionComponent
7
+ # Shared functionality of revision components and nested revision
8
+ # components.
9
+ module Container
10
+ extend ActiveSupport::Concern
11
+
12
+ included do
13
+ cattr_accessor :nested_revision_component_collection_names, default: []
14
+ end
15
+
16
+ # @api private
17
+ def copy_nested_revision_component_to(record)
18
+ nested_revision_component_collection_names.each do |collection_name|
19
+ send(collection_name).each do |nested|
20
+ nested.copy_to(record.send(collection_name))
21
+ end
22
+ end
23
+ end
24
+
25
+ # Macro methods to declare nested revision components
26
+ module ClassMethods
27
+ # Call this macro in the body of a class which includes
28
+ # `RevisionComponent` or `NestedRevisionComponent` and pass
29
+ # the name of an association that shall be included when the
30
+ # revision component is copied to a new revision. The
31
+ # associated model needs to be a `NestedRevisionComponent`.
32
+ def nested_revision_components(*collection_names)
33
+ self.nested_revision_component_collection_names = collection_names
34
+ end
35
+ end
36
+ end
37
+
38
+ extend ActiveSupport::Concern
39
+ include Container
40
+
41
+ # @api private
42
+ def copy_to(collection)
43
+ record = dup
44
+ collection << record
45
+
46
+ copy_nested_revision_component_to(record)
47
+ end
48
+ end
49
+ end
@@ -1,11 +1,13 @@
1
1
  module Pageflow
2
2
  module React
3
+ # @deprecated Use `PageflowPaged::React.create_page_type` instead.
3
4
  def self.create_page_type(name, options = {})
4
- Pageflow::React::PageType.new(name, options)
5
+ PageflowPaged::React.create_page_type(name, options)
5
6
  end
6
7
 
8
+ # @deprecated Use `PageflowPaged::React.create_widget_type` instead.
7
9
  def self.create_widget_type(name, role, options = {})
8
- Pageflow::React::WidgetType.new(name, role, options)
10
+ PageflowPaged::React.create_widget_type(name, role, options)
9
11
  end
10
12
  end
11
13
  end
@@ -2,8 +2,9 @@ module Pageflow
2
2
  # RevisionComponent represents a model that is attached to the revision
3
3
  # mechanism of Pageflow.
4
4
  #
5
- # In order to be used as a ComponentModel a model is required to
6
- # have an integer field `perma_id` and a belongs_to field `revision`.
5
+ # In order to be used as a revision component, a model is required
6
+ # to have an integer field `perma_id` and a `revision_id` foreign
7
+ # key.
7
8
  module RevisionComponent
8
9
  extend ActiveSupport::Concern
9
10
 
@@ -13,6 +14,7 @@ module Pageflow
13
14
 
14
15
  included do
15
16
  include AutoGeneratedPermaId
17
+ include NestedRevisionComponent::Container
16
18
 
17
19
  belongs_to :revision, class_name: 'Pageflow::Revision', touch: true
18
20
  end
@@ -21,6 +23,8 @@ module Pageflow
21
23
  record = dup
22
24
  record.revision = revision
23
25
  record.save!
26
+
27
+ copy_nested_revision_component_to(record)
24
28
  end
25
29
 
26
30
  module ClassMethods
@@ -36,6 +36,10 @@ module Pageflow
36
36
  # @option options :hide_logo_option [Boolean]
37
37
  # Pass true if hiding the logo on specific pages should be supported
38
38
  # as an option in the editor.
39
+ #
40
+ # @option options :logo_url [String]
41
+ # Pass logo url as string to turn the logo in navigation bar into a link.
42
+ #
39
43
  def register(name, options = {})
40
44
  @themes[name] = Theme.new(name, options)
41
45
  end