pageflow 15.5.0 → 15.7.0

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 (270) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +219 -87
  3. data/README.md +1 -2
  4. data/admins/pageflow/entry.rb +28 -57
  5. data/admins/pageflow/user.rb +1 -3
  6. data/app/assets/images/pageflow/admin/icons/buttons/editor.svg +2 -0
  7. data/app/assets/images/pageflow/admin/icons/buttons/preview.svg +2 -0
  8. data/app/assets/images/pageflow/admin/icons/buttons/show_public.svg +2 -0
  9. data/app/assets/images/pageflow/admin/icons/delete.svg +9 -0
  10. data/app/assets/images/pageflow/admin/icons/done.svg +6 -0
  11. data/app/assets/images/pageflow/admin/icons/edit.svg +7 -0
  12. data/app/assets/images/pageflow/admin/icons/editor.svg +2 -0
  13. data/app/assets/images/pageflow/admin/icons/folder.svg +8 -0
  14. data/app/assets/images/pageflow/admin/icons/folder_active.svg +8 -0
  15. data/app/assets/images/pageflow/admin/icons/info.svg +3 -0
  16. data/app/assets/images/pageflow/admin/icons/new.svg +5 -0
  17. data/app/assets/images/pageflow/admin/icons/preview.svg +2 -0
  18. data/app/assets/images/pageflow/admin/icons/published.svg +2 -0
  19. data/app/assets/images/pageflow/admin/icons/published_with_password.svg +2 -0
  20. data/app/assets/images/pageflow/admin/icons/show_public.svg +2 -0
  21. data/app/assets/images/pageflow/editor/blank_entry/logo.png +0 -0
  22. data/app/assets/images/pageflow/themes/default/embed_opt_in.svg +3 -0
  23. data/app/assets/images/pageflow/themes/default/embed_opt_out_info.svg +16 -0
  24. data/app/assets/javascripts/pageflow/admin/entries.js +9 -57
  25. data/app/assets/javascripts/pageflow/dist/ui.js +127 -10
  26. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +18 -16
  27. data/app/assets/stylesheets/pageflow/admin/badge_list.scss +25 -35
  28. data/app/assets/stylesheets/pageflow/admin/columns.scss +13 -11
  29. data/app/assets/stylesheets/pageflow/admin/embed_code.scss +1 -4
  30. data/app/assets/stylesheets/pageflow/admin/entries/folders.scss +44 -19
  31. data/app/assets/stylesheets/pageflow/admin/entries.scss +15 -31
  32. data/app/assets/stylesheets/pageflow/admin/features.scss +3 -1
  33. data/app/assets/stylesheets/pageflow/admin/forms.scss +14 -12
  34. data/app/assets/stylesheets/pageflow/admin/hint.scss +8 -14
  35. data/app/assets/stylesheets/pageflow/admin/icon_button.scss +25 -14
  36. data/app/assets/stylesheets/pageflow/admin/icon_link.scss +31 -15
  37. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +14 -7
  38. data/app/assets/stylesheets/pageflow/admin/status_tags.scss +5 -4
  39. data/app/assets/stylesheets/pageflow/admin/tabs_view.scss +36 -34
  40. data/app/assets/stylesheets/pageflow/admin/tooltip_bubble.scss +15 -11
  41. data/app/assets/stylesheets/pageflow/admin.scss +12 -0
  42. data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +15 -61
  43. data/app/assets/stylesheets/pageflow/editor/base.scss +28 -13
  44. data/app/assets/stylesheets/pageflow/editor/blank_entry.scss +6 -6
  45. data/app/assets/stylesheets/pageflow/editor/change_theme.scss +28 -71
  46. data/app/assets/stylesheets/pageflow/editor/composables.scss +2 -2
  47. data/app/assets/stylesheets/pageflow/editor/confirm_encoding.scss +18 -36
  48. data/app/assets/stylesheets/pageflow/editor/confirm_upload.scss +12 -39
  49. data/app/assets/stylesheets/pageflow/editor/dialogs.scss +39 -12
  50. data/app/assets/stylesheets/pageflow/editor/disabled_atmo_indicator.scss +3 -3
  51. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -10
  52. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +3 -8
  53. data/app/assets/stylesheets/pageflow/editor/failures.scss +3 -3
  54. data/app/assets/stylesheets/pageflow/editor/file_import.scss +22 -38
  55. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +3 -7
  56. data/app/assets/stylesheets/pageflow/editor/file_settings_dialog.scss +4 -24
  57. data/app/assets/stylesheets/pageflow/editor/file_stages.scss +10 -11
  58. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -8
  59. data/app/assets/stylesheets/pageflow/editor/files.scss +7 -6
  60. data/app/assets/stylesheets/pageflow/editor/files_explorer.scss +13 -30
  61. data/app/assets/stylesheets/pageflow/editor/files_gallery.scss +15 -11
  62. data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +6 -7
  63. data/app/assets/stylesheets/pageflow/editor/help.scss +19 -14
  64. data/app/assets/stylesheets/pageflow/editor/help_image.scss +1 -1
  65. data/app/assets/stylesheets/pageflow/editor/info_box.scss +19 -0
  66. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +7 -11
  67. data/app/assets/stylesheets/pageflow/editor/inputs/file_processing_state_display.scss +0 -2
  68. data/app/assets/stylesheets/pageflow/editor/inputs/reference.scss +7 -11
  69. data/app/assets/stylesheets/pageflow/editor/list.scss +13 -10
  70. data/app/assets/stylesheets/pageflow/editor/loading.scss +1 -1
  71. data/app/assets/stylesheets/pageflow/editor/locked.scss +9 -5
  72. data/app/assets/stylesheets/pageflow/editor/menu.scss +5 -5
  73. data/app/assets/stylesheets/pageflow/editor/notifications.scss +15 -14
  74. data/app/assets/stylesheets/pageflow/editor/other_entry_item.scss +7 -3
  75. data/app/assets/stylesheets/pageflow/editor/outline.scss +57 -19
  76. data/app/assets/stylesheets/pageflow/editor/page_links.scss +10 -8
  77. data/app/assets/stylesheets/pageflow/editor/page_selection.scss +2 -29
  78. data/app/assets/stylesheets/pageflow/editor/publish_entry.scss +5 -6
  79. data/app/assets/stylesheets/pageflow/editor/quotas.scss +2 -3
  80. data/app/assets/stylesheets/pageflow/editor/select_button.scss +12 -6
  81. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -5
  82. data/app/assets/stylesheets/pageflow/editor/storyline_picker.scss +6 -2
  83. data/app/assets/stylesheets/pageflow/editor/text_tracks.scss +6 -22
  84. data/app/assets/stylesheets/pageflow/editor/widgets.scss +2 -2
  85. data/app/assets/stylesheets/pageflow/editor/wysihtml5.scss +35 -29
  86. data/app/assets/stylesheets/pageflow/mixins/background_icons.scss +3 -3
  87. data/app/assets/stylesheets/pageflow/mixins/buttons.scss +50 -68
  88. data/app/assets/stylesheets/pageflow/themes/default/base.scss +2 -0
  89. data/app/assets/stylesheets/pageflow/themes/default/consent/bar.scss +156 -0
  90. data/app/assets/stylesheets/pageflow/themes/default/consent/vendor_list.scss +62 -0
  91. data/app/assets/stylesheets/pageflow/themes/default/consent.scss +2 -0
  92. data/app/assets/stylesheets/pageflow/themes/default/logo/alignment.scss +7 -0
  93. data/app/assets/stylesheets/pageflow/themes/default/page/shadow.scss +44 -0
  94. data/app/assets/stylesheets/pageflow/themes/default/third_party_embed_consent.scss +103 -0
  95. data/app/assets/stylesheets/pageflow/ui/forms.scss +79 -84
  96. data/app/assets/stylesheets/pageflow/ui/functions.scss +56 -0
  97. data/app/assets/stylesheets/pageflow/ui/input/check_box_group_input.scss +2 -3
  98. data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +6 -6
  99. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +63 -50
  100. data/app/assets/stylesheets/pageflow/ui/normalize/forms.scss +153 -0
  101. data/app/assets/stylesheets/pageflow/ui/normalize.scss +278 -0
  102. data/app/assets/stylesheets/pageflow/ui/properties.scss +44 -0
  103. data/app/assets/stylesheets/pageflow/ui/table_cells/delete_row_table_cell.scss +1 -1
  104. data/app/assets/stylesheets/pageflow/ui/table_view.scss +14 -18
  105. data/app/assets/stylesheets/pageflow/ui/tabs_view.scss +8 -11
  106. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +6 -8
  107. data/app/assets/stylesheets/pageflow/ui/validation_error_messages.scss +6 -0
  108. data/app/assets/stylesheets/pageflow/ui.scss +4 -0
  109. data/app/controllers/pageflow/edit_locks_controller.rb +3 -1
  110. data/app/helpers/pageflow/admin/entries_helper.rb +2 -12
  111. data/app/helpers/pageflow/embed_code_helper.rb +1 -1
  112. data/app/helpers/pageflow/entries_helper.rb +41 -2
  113. data/app/helpers/pageflow/file_background_images_helper.rb +1 -1
  114. data/app/helpers/pageflow/page_types_helper.rb +1 -1
  115. data/app/helpers/pageflow/themes_helper.rb +1 -1
  116. data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -1
  117. data/app/jobs/pageflow/poll_zencoder_job.rb +1 -9
  118. data/app/models/pageflow/audio_file.rb +17 -0
  119. data/app/models/pageflow/audio_file_url_templates.rb +4 -1
  120. data/app/models/pageflow/customized_theme.rb +37 -0
  121. data/app/models/pageflow/draft_entry.rb +6 -59
  122. data/app/models/pageflow/entry_at_revision.rb +68 -0
  123. data/app/models/pageflow/entry_role_query.rb +44 -24
  124. data/app/models/pageflow/image_file_css_background_image_urls.rb +8 -2
  125. data/app/models/pageflow/published_entry.rb +9 -56
  126. data/app/models/pageflow/theme_customization.rb +46 -0
  127. data/app/models/pageflow/theme_customization_file.rb +58 -0
  128. data/app/models/pageflow/video_file.rb +11 -1
  129. data/app/models/pageflow/video_file_url_templates.rb +1 -0
  130. data/app/policies/pageflow/entry_policy.rb +4 -0
  131. data/app/state_machines/pageflow/media_encoding_state_machine.rb +23 -4
  132. data/app/views/admin/entries/_form.html.erb +50 -0
  133. data/app/views/admin/entries/entry_type_name_input.html.erb +5 -0
  134. data/app/views/admin/features/_form.html.erb +1 -1
  135. data/app/views/admin/memberships/_form.html.erb +2 -3
  136. data/app/views/admin/users/_form.html.erb +1 -1
  137. data/app/views/admin/users/invitation.html.erb +2 -2
  138. data/app/views/components/pageflow/admin/entry_user_badge_list.rb +10 -9
  139. data/app/views/components/pageflow/admin/members_tab.rb +5 -1
  140. data/app/views/components/pageflow/admin/revisions_tab.rb +13 -3
  141. data/app/views/components/pageflow/admin/timestamp.rb +20 -0
  142. data/app/views/components/pageflow/admin/user_account_badge_list.rb +5 -6
  143. data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +9 -5
  144. data/app/views/pageflow/admin/entries/_entry_type_name_input.html.erb +7 -0
  145. data/app/views/pageflow/audio_files/_audio_file.json.jbuilder +13 -0
  146. data/app/views/pageflow/editor/encoding_confirmations/_intro.html.erb +0 -0
  147. data/app/views/pageflow/editor/encoding_confirmations/check.json.jbuilder +14 -2
  148. data/config/initializers/paperclip.rb +16 -1
  149. data/config/locales/de.yml +24 -28
  150. data/config/locales/en.yml +19 -10
  151. data/db/migrate/20210528073122_create_pageflow_theme_customizations.rb +11 -0
  152. data/db/migrate/20210531090654_create_pageflow_theme_customization_files.rb +15 -0
  153. data/db/migrate/20210531102228_add_selected_file_ids_to_theme_customizations.rb +5 -0
  154. data/db/migrate/20211020085902_add_canonical_entry_url_prefix_to_themings.rb +5 -0
  155. data/db/migrate/20220503150010_add_peak_data_to_audio_files.rb +5 -0
  156. data/db/migrate/20220705084830_add_trailing_slash_in_canonical_urls_to_themings.rb +5 -0
  157. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +256 -124
  158. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +566 -167
  159. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +5 -5
  160. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +4 -4
  161. data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +38 -0
  162. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_in.html.erb +12 -0
  163. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_out_info.html.erb +10 -0
  164. data/entry_types/paged/config/initializers/features.rb +2 -0
  165. data/entry_types/paged/config/locales/new/video_contain.de.yml +7 -0
  166. data/entry_types/paged/config/locales/new/video_contain.en.yml +7 -0
  167. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
  168. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +1 -0
  169. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +58 -0
  170. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +37 -3
  171. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +92 -6
  172. data/entry_types/scrolled/app/helpers/pageflow_scrolled/webpack_public_path_helper.rb +20 -0
  173. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +7 -0
  174. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +5 -2
  175. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +5 -1
  176. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +5 -4
  177. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +16 -0
  178. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +13 -2
  179. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_widget.json.jbuilder +2 -0
  180. data/entry_types/scrolled/config/locales/de.yml +1 -8
  181. data/entry_types/scrolled/config/locales/en.yml +1 -9
  182. data/entry_types/scrolled/config/locales/new/before_after_slider.de.yml +8 -0
  183. data/entry_types/scrolled/config/locales/new/before_after_slider.en.yml +8 -0
  184. data/entry_types/scrolled/config/locales/new/center_ragged.de.yml +8 -0
  185. data/entry_types/scrolled/config/locales/new/center_ragged.en.yml +9 -0
  186. data/entry_types/scrolled/config/locales/new/consent.de.yml +25 -0
  187. data/entry_types/scrolled/config/locales/new/consent.en.yml +24 -0
  188. data/entry_types/scrolled/config/locales/new/content_element_categories.de.yml +39 -0
  189. data/entry_types/scrolled/config/locales/new/content_element_categories.en.yml +39 -0
  190. data/entry_types/scrolled/config/locales/new/default_transition.de.yml +14 -0
  191. data/entry_types/scrolled/config/locales/new/default_transition.en.yml +14 -0
  192. data/entry_types/scrolled/config/locales/new/header_line_breaks.de.yml +28 -0
  193. data/entry_types/scrolled/config/locales/new/header_line_breaks.en.yml +27 -0
  194. data/entry_types/scrolled/config/locales/new/header_size.de.yml +17 -0
  195. data/entry_types/scrolled/config/locales/new/header_size.en.yml +17 -0
  196. data/entry_types/scrolled/config/locales/new/iframe_embed.de.yml +39 -0
  197. data/entry_types/scrolled/config/locales/new/iframe_embed.en.yml +39 -0
  198. data/entry_types/scrolled/config/locales/new/inline_loops.de.yml +26 -0
  199. data/entry_types/scrolled/config/locales/new/inline_loops.en.yml +26 -0
  200. data/entry_types/scrolled/config/locales/new/portrait_inline_image.de.yml +9 -0
  201. data/entry_types/scrolled/config/locales/new/portrait_inline_image.en.yml +9 -0
  202. data/entry_types/scrolled/config/locales/new/section_width.de.yml +10 -0
  203. data/entry_types/scrolled/config/locales/new/section_width.en.yml +10 -0
  204. data/entry_types/scrolled/config/locales/new/typography_variants.de.yml +7 -0
  205. data/entry_types/scrolled/config/locales/new/typography_variants.en.yml +7 -0
  206. data/entry_types/scrolled/config/locales/new/video_embed_poster.de.yml +8 -0
  207. data/entry_types/scrolled/config/locales/new/video_embed_poster.en.yml +8 -0
  208. data/entry_types/scrolled/config/locales/new/waveform_styles.de.yml +11 -0
  209. data/entry_types/scrolled/config/locales/new/waveform_styles.en.yml +12 -0
  210. data/entry_types/scrolled/config/locales/new/widgets.de.yml +6 -0
  211. data/entry_types/scrolled/config/locales/new/widgets.en.yml +6 -0
  212. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +29 -5
  213. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +8 -6
  214. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +37 -0
  215. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +57 -0
  216. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +49 -0
  217. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +2 -0
  218. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +8 -0
  219. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +42 -0
  220. data/entry_types/scrolled/lib/pageflow_scrolled.rb +17 -1
  221. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +3 -2
  222. data/entry_types/scrolled/package/config/webpack.js +11 -0
  223. data/entry_types/scrolled/package/contentElements-editor.js +323 -89
  224. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  225. data/entry_types/scrolled/package/contentElements-frontend.js +719 -529
  226. data/entry_types/scrolled/package/editor.js +459 -261
  227. data/entry_types/scrolled/package/frontend/{EditableText-7093fd0e.js → EditableInlineText.module-b9923660.js} +284 -362
  228. data/entry_types/scrolled/package/frontend/{i18n-4dc6c377.js → PhonePlatformContext-9fb97827.js} +199 -106
  229. data/entry_types/scrolled/package/frontend/{Viewer-e49e7807.js → Viewer-e2290ea0.js} +196 -79
  230. data/entry_types/scrolled/package/frontend/{Wavesurfer-0adf5667.js → Wavesurfer-7d9cf1b7.js} +16 -58
  231. data/entry_types/scrolled/package/frontend/{components-6a6793ca.js → components-6ab26015.js} +664 -671
  232. data/entry_types/scrolled/package/frontend/{getPrototypeOf-63c7c8e8.js → createSuper-d0f30da3.js} +34 -5
  233. data/entry_types/scrolled/package/frontend/index.css +1 -9
  234. data/entry_types/scrolled/package/frontend/index.js +1919 -2386
  235. data/entry_types/scrolled/package/frontend/{useBrowserFeature-91a4c29d.js → usePhonePlatform-2857c22b.js} +9 -8
  236. data/entry_types/scrolled/package/frontend-server.js +3 -6
  237. data/entry_types/scrolled/package/package.json +16 -8
  238. data/entry_types/scrolled/package/testHelpers.js +456 -0
  239. data/entry_types/scrolled/package/values/breakpoints.module.css +9 -0
  240. data/entry_types/scrolled/package/values/colors.module.css +5 -0
  241. data/entry_types/scrolled/package/widgets/defaultNavigation.css +9 -0
  242. data/entry_types/scrolled/package/widgets/defaultNavigation.js +612 -0
  243. data/entry_types/scrolled/spec/fixtures/image.svg +1 -0
  244. data/lib/pageflow/ability_mixin.rb +4 -0
  245. data/lib/pageflow/built_in_widget_type.rb +4 -0
  246. data/lib/pageflow/built_in_widget_types_plugin.rb +7 -0
  247. data/lib/pageflow/configuration.rb +34 -1
  248. data/lib/pageflow/entry_type.rb +11 -2
  249. data/lib/pageflow/entry_type_configuration.rb +2 -0
  250. data/lib/pageflow/file_type.rb +24 -0
  251. data/lib/pageflow/paperclip_processors/audio_waveform.rb +42 -0
  252. data/lib/pageflow/paperclip_processors/noop.rb +10 -0
  253. data/lib/pageflow/theme_customizations.rb +61 -0
  254. data/lib/pageflow/version.rb +1 -1
  255. data/lib/pageflow.rb +9 -0
  256. data/package/config/jest/index.js +2 -1
  257. data/package/config/postcss/scaleFunctions.js +71 -0
  258. data/package/editor.js +95 -85
  259. data/package/frontend.js +521 -161
  260. data/package/package.json +5 -3
  261. data/package/testHelpers.js +26 -5
  262. data/package/ui.js +124 -11
  263. data/spec/factories/draft_entries.rb +19 -1
  264. data/spec/factories/entries.rb +4 -0
  265. data/spec/factories/published_entries.rb +6 -0
  266. data/spec/fixtures/audio.ogg +0 -0
  267. metadata +119 -14
  268. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +0 -2
  269. data/app/views/admin/entries/entry_types.json.jbuilder +0 -4
  270. data/package/config/jest/transformers/upwardBabel.js +0 -5
data/package/package.json CHANGED
@@ -7,12 +7,13 @@
7
7
  "author": "Codevise Solutions GmbH <info@codevise.de>",
8
8
  "license": "MIT",
9
9
  "devDependencies": {
10
- "babel-jest": "^24.9.0",
10
+ "@testing-library/jest-dom": "^5.14.1",
11
+ "babel-jest": "^27.0.6",
11
12
  "eslint": "^6.6.0",
12
13
  "eslint-import-resolver-jest": "^3.0.0",
13
14
  "eslint-plugin-import": "^2.18.2",
14
15
  "eslint-plugin-jest": "^23.0.4",
15
- "jest": "^24.9.0",
16
+ "jest": "^27.0.6",
16
17
  "jest-css-modules-processor": "^0.0.9",
17
18
  "jest-jquery-matchers": "^2.1.0",
18
19
  "jest-sinon": "^1.0.0",
@@ -26,6 +27,7 @@
26
27
  "backbone-events-standalone": "^0.2.7",
27
28
  "classlist.js": "^1.1.20150312",
28
29
  "core-js": "^3.4.1",
29
- "i18n-js": "^3.5.1"
30
+ "i18n-js": "^3.5.1",
31
+ "postcss-functions": "^3.0.0"
30
32
  }
31
33
  }
@@ -2,7 +2,8 @@ import $ from 'jquery';
2
2
  import _ from 'underscore';
3
3
  import { Object as Object$1 } from 'pageflow/ui';
4
4
  import Backbone from 'backbone';
5
- import { Entry, Theme, FileTypes, FilesCollection, SubsetCollection, ImageFile, WidgetTypes, EditorApi, VideoFile, TextTrackFile } from 'pageflow/editor';
5
+ import { Entry, Theme, FileTypes, FilesCollection, SubsetCollection, ImageFile, WidgetTypes, EditorApi, WidgetsCollection, VideoFile, TextTrackFile } from 'pageflow/editor';
6
+ import { browser } from 'pageflow/frontend';
6
7
  import I18n from 'i18n-js';
7
8
 
8
9
  var Base = Object$1.extend({
@@ -67,9 +68,7 @@ Base.classMethods = function (Constructor) {
67
68
  };
68
69
  };
69
70
 
70
- Base.extend = function ()
71
- /* arguments */
72
- {
71
+ Base.extend = function () {
73
72
  var result = Object$1.extend.apply(this, arguments);
74
73
 
75
74
  _.extend(result, Base.classMethods(result));
@@ -377,6 +376,7 @@ var factories = {
377
376
 
378
377
  ensureFileTypes(options);
379
378
  ensureFilesCollections(options);
379
+ ensureWidgetsCollections(options);
380
380
  var entry = new model(_objectSpread2({
381
381
  id: 1
382
382
  }, attributes), _.extend({
@@ -614,6 +614,27 @@ function ensureFilesCollections(options) {
614
614
  }
615
615
  }
616
616
 
617
+ function ensureWidgetsCollections(options) {
618
+ if (!options.widgets) {
619
+ options.widgets = new WidgetsCollection(options.widgetsAttributes);
620
+ }
621
+ }
622
+
623
+ var userAgents = {
624
+ 'Safari on iPhone': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_1 like Mac OS X) ' + 'AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0' + 'Mobile/14A403 Safari/602.1',
625
+ 'Safari on macOS': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) ' + 'AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 ' + 'Safari/605.1.15',
626
+ 'Chrome on Android': 'Mozilla/5.0 (Linux; Android 10) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106' + 'Mobile Safari/537.36',
627
+ 'Chrome on iPhone': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X)' + 'AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75' + 'Mobile/14E5239e Safari/602.1',
628
+ 'Chrome on Windows': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' + '(KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
629
+ };
630
+ function fakeBrowserAgent(name) {
631
+ if (!userAgents[name]) {
632
+ throw new Error("Unknown browser ".concat(name, "."));
633
+ }
634
+
635
+ return new browser.Agent(userAgents[name]);
636
+ }
637
+
617
638
  var state = window.pageflow || {};
618
639
 
619
640
  /**
@@ -729,4 +750,4 @@ function keysWithDotsToNestedObjects(translations) {
729
750
  }, {});
730
751
  }
731
752
 
732
- export { ColorInput, ConfigurationEditor, ConfigurationEditorTab, DropDownButton, FileMetaDataTable, FileStageItem, FileThumbnail, RadioButtonGroupInput, ReferenceInput, SelectInput, StaticThumbnail, Table, Tabs, ThemeItem, factories, setupGlobals, useFakeTranslations };
753
+ export { ColorInput, ConfigurationEditor, ConfigurationEditorTab, DropDownButton, FileMetaDataTable, FileStageItem, FileThumbnail, RadioButtonGroupInput, ReferenceInput, SelectInput, StaticThumbnail, Table, Tabs, ThemeItem, factories, fakeBrowserAgent, setupGlobals, useFakeTranslations };
data/package/ui.js CHANGED
@@ -349,6 +349,24 @@ _.extend(BaseObject.prototype, Backbone.Events, {
349
349
 
350
350
  BaseObject.extend = Backbone.Model.extend;
351
351
 
352
+ var serverSideValidation = {
353
+ initialize: function initialize() {
354
+ var _this = this;
355
+
356
+ this.validationErrors = {};
357
+ this.listenTo(this, 'error', function (model, request) {
358
+ if (request.status === 422) {
359
+ _this.validationErrors = JSON.parse(request.responseText).errors;
360
+
361
+ _this.trigger('invalid');
362
+ }
363
+ });
364
+ this.listenTo(this, 'sync', function () {
365
+ _this.validationErrors = {};
366
+ });
367
+ }
368
+ };
369
+
352
370
  var CollectionView = Marionette.View.extend({
353
371
  initialize: function initialize() {
354
372
  this.rendered = false;
@@ -749,10 +767,12 @@ var ConfigurationEditorView = Marionette.View.extend({
749
767
  this.configure();
750
768
  },
751
769
  configure: function configure() {},
752
- tab: function tab(name, callback) {
770
+ tab: function tab(name, callbackOrOptions, callback) {
771
+ callback = callback || callbackOrOptions;
772
+ var options = callback ? callbackOrOptions : {};
753
773
  this.tabsView.tab(name, _.bind(function () {
754
774
  var tabView = new ConfigurationEditorTabView({
755
- model: this.model,
775
+ model: options.model || this.model,
756
776
  placeholderModel: this.options.placeholderModel,
757
777
  tab: name,
758
778
  attributeTranslationKeyPrefixes: this.options.attributeTranslationKeyPrefixes
@@ -893,7 +913,7 @@ var TableCellView = Marionette.ItemView.extend({
893
913
  var TableHeaderCellView = TableCellView.extend({
894
914
  tagName: 'th',
895
915
  render: function render() {
896
- this.$el.text(this.attributeTranslation('column_header'));
916
+ this.$el.text(this.options.column.headerText || this.attributeTranslation('column_header'));
897
917
  this.$el.data('columnName', this.options.column.name);
898
918
  return this;
899
919
  }
@@ -1270,6 +1290,7 @@ var inputView = {
1270
1290
  return this.getAttributeBoundOption('disabled');
1271
1291
  },
1272
1292
  updateDisabled: function updateDisabled() {
1293
+ this.$el.toggleClass('input-disabled', !!this.isDisabled());
1273
1294
  this.updateInlineHelp();
1274
1295
 
1275
1296
  if (this.ui.input) {
@@ -1497,6 +1518,31 @@ var inputWithPlaceholderText = {
1497
1518
  }
1498
1519
  };
1499
1520
 
1521
+ var viewWithValidationErrorMessages = {
1522
+ onRender: function onRender() {
1523
+ this.listenTo(this.model, 'invalid sync', this.updateValidationErrorMessages);
1524
+ this.updateValidationErrorMessages();
1525
+ },
1526
+ updateValidationErrorMessages: function updateValidationErrorMessages() {
1527
+ var _this = this;
1528
+
1529
+ var errors = this.model.validationErrors && this.model.validationErrors[this.options.propertyName] || [];
1530
+
1531
+ if (errors.length) {
1532
+ this.validationErrorList = this.validationErrorList || $('<ul class="validation_error_messages" />').appendTo(this.el);
1533
+ this.validationErrorList.html('');
1534
+ errors.forEach(function (error) {
1535
+ return _this.validationErrorList.append("<li>".concat(error, "</li>"));
1536
+ });
1537
+ this.$el.addClass('invalid');
1538
+ } else if (this.validationErrorList) {
1539
+ this.validationErrorList.remove();
1540
+ this.validationErrorList = null;
1541
+ this.$el.removeClass('invalid');
1542
+ }
1543
+ }
1544
+ };
1545
+
1500
1546
  function template$6(data) {
1501
1547
  var __p = '';
1502
1548
  __p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<input type="text" dir="auto" />\n';
@@ -1524,7 +1570,7 @@ return __p
1524
1570
  */
1525
1571
 
1526
1572
  var TextInputView = Marionette.ItemView.extend({
1527
- mixins: [inputView, inputWithPlaceholderText],
1573
+ mixins: [inputView, inputWithPlaceholderText, viewWithValidationErrorMessages],
1528
1574
  template: template$6,
1529
1575
  ui: {
1530
1576
  input: 'input'
@@ -2024,9 +2070,9 @@ __p += '<label>\n <span class="name"></span>\n <span class="inline_help"></spa
2024
2070
  ((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.link_type.url') )) == null ? '' : __t) +
2025
2071
  '\n </label>\n <label>\n <input type="radio" name="link_type" class="fragment_link_radio_button">\n ' +
2026
2072
  ((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.link_type.page_link') )) == null ? '' : __t) +
2027
- '\n </label>\n </div>\n <div class="url_link_panel">\n <label>\n ' +
2073
+ '\n </label>\n </div>\n <div class="url_link_panel">\n <label>\n <span>\n ' +
2028
2074
  ((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.target') )) == null ? '' : __t) +
2029
- '\n </label>\n <input type="text" class="display_url">\n <div class="open_in_new_tab_section">\n <label>\n <input type="checkbox" class="open_in_new_tab">\n ' +
2075
+ '\n </span>\n </label>\n <input type="text" class="display_url">\n <div class="open_in_new_tab_section">\n <label>\n <input type="checkbox" class="open_in_new_tab">\n ' +
2030
2076
  ((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.open_in_new_tab') )) == null ? '' : __t) +
2031
2077
  '\n </label>\n <span class="inline_help">\n ' +
2032
2078
  ((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.open_in_new_tab_help') )) == null ? '' : __t) +
@@ -2360,6 +2406,15 @@ var UrlInputView = Marionette.Layout.extend(
2360
2406
  supportedHosts: function supportedHosts() {
2361
2407
  return this.options.supportedHosts;
2362
2408
  },
2409
+ // Host names used to be expected to include protocols. Remove
2410
+ // protocols for backwards compatilbity. Since supportedHosts
2411
+ // is supposed to be overridden in subclasses, we do it in a
2412
+ // separate method.
2413
+ supportedHostsWithoutLegacyProtocols: function supportedHostsWithoutLegacyProtocols() {
2414
+ return _.map(this.supportedHosts(), function (host) {
2415
+ return host.replace(/^https?:\/\//, '');
2416
+ });
2417
+ },
2363
2418
  validate: function validate(success) {
2364
2419
  var view = this;
2365
2420
  var options = this.options;
@@ -2396,23 +2451,26 @@ var UrlInputView = Marionette.Layout.extend(
2396
2451
  }
2397
2452
 
2398
2453
  function hasSupportedHost(url) {
2399
- return _.any(view.supportedHosts(), function (host) {
2400
- return url.match(new RegExp('^' + host));
2454
+ return _.any(view.supportedHostsWithoutLegacyProtocols(), function (host) {
2455
+ return url.match(new RegExp('^https?://' + host));
2401
2456
  });
2402
2457
  }
2403
2458
 
2404
2459
  function displayValidationError(message) {
2405
2460
  view.$el.addClass('invalid');
2461
+ view.ui.input.attr('aria-invalid', 'true');
2406
2462
  view.ui.validation.removeClass('pending').addClass('failed').html(message).show();
2407
2463
  }
2408
2464
 
2409
2465
  function displayValidationPending(message) {
2410
2466
  view.$el.removeClass('invalid');
2467
+ view.ui.input.removeAttr('aria-invalid');
2411
2468
  view.ui.validation.removeClass('failed').addClass('pending').html(message).show();
2412
2469
  }
2413
2470
 
2414
2471
  function resetValidationError(message) {
2415
2472
  view.$el.removeClass('invalid');
2473
+ view.ui.input.attr('aria-invalid', 'false');
2416
2474
  view.ui.validation.hide();
2417
2475
  }
2418
2476
  }
@@ -2647,6 +2705,15 @@ return __p
2647
2705
  * Ignore the attribute value if the input is disabled and display
2648
2706
  * an unchecked check box.
2649
2707
  *
2708
+ * @param {boolean} [options.displayCheckedIfDisabled=false]
2709
+ * Ignore the attribute value if the input is disabled and display
2710
+ * an checked check box.
2711
+ *
2712
+ * @param {string} [options.storeInverted]
2713
+ * Display checked by default and store true in given attribute when
2714
+ * unchecked. The property name passed to `input` is only used for
2715
+ * translations.
2716
+ *
2650
2717
  * @class
2651
2718
  */
2652
2719
 
@@ -2672,7 +2739,13 @@ var CheckBoxInputView = Marionette.ItemView.extend({
2672
2739
  },
2673
2740
  save: function save() {
2674
2741
  if (!this.isDisabled()) {
2675
- this.model.set(this.options.propertyName, this.ui.input.is(':checked'));
2742
+ var value = this.ui.input.is(':checked');
2743
+
2744
+ if (this.options.storeInverted) {
2745
+ this.model.set(this.options.storeInverted, !value);
2746
+ } else {
2747
+ this.model.set(this.options.propertyName, value);
2748
+ }
2676
2749
  }
2677
2750
  },
2678
2751
  load: function load() {
@@ -2683,12 +2756,49 @@ var CheckBoxInputView = Marionette.ItemView.extend({
2683
2756
  displayValue: function displayValue() {
2684
2757
  if (this.isDisabled() && this.options.displayUncheckedIfDisabled) {
2685
2758
  return false;
2759
+ } else if (this.isDisabled() && this.options.displayCheckedIfDisabled) {
2760
+ return true;
2761
+ } else if (this.options.storeInverted) {
2762
+ return !this.model.get(this.options.storeInverted);
2686
2763
  } else {
2687
2764
  return this.model.get(this.options.propertyName);
2688
2765
  }
2689
2766
  }
2690
2767
  });
2691
2768
 
2769
+ /**
2770
+ * Render a separator in a {@link ConfigurationEditorView} tab.
2771
+ *
2772
+ * @example
2773
+ *
2774
+ * this.view(SeparatorView);
2775
+ *
2776
+ * @class
2777
+ */
2778
+
2779
+ var SeparatorView = Marionette.View.extend({
2780
+ className: 'separator'
2781
+ });
2782
+
2783
+ /**
2784
+ * Render an input that is only a label. Can be used to render
2785
+ * additional inline help.
2786
+ *
2787
+ * See {@link inputView} for further options
2788
+ *
2789
+ * @class
2790
+ */
2791
+
2792
+ var LabelOnlyView = Marionette.ItemView.extend({
2793
+ mixins: [inputView],
2794
+ template: function template() {
2795
+ return "\n <label>\n <span class=\"name\"></span>\n <span class=\"inline_help\"></span>\n </label>\n ";
2796
+ },
2797
+ ui: {
2798
+ label: 'label'
2799
+ }
2800
+ });
2801
+
2692
2802
  /**
2693
2803
  * A table cell mapping column attribute values to a list of
2694
2804
  * translations.
@@ -2908,7 +3018,10 @@ var subviewContainer = {
2908
3018
  }
2909
3019
  }
2910
3020
  };
2911
- Cocktail.mixin(Marionette.View, subviewContainer);
3021
+
3022
+ if (!Marionette.View.prototype.appendSubview) {
3023
+ Cocktail.mixin(Marionette.View, subviewContainer);
3024
+ }
2912
3025
 
2913
3026
  var tooltipContainer = {
2914
3027
  events: {
@@ -2954,4 +3067,4 @@ var tooltipContainer = {
2954
3067
  }
2955
3068
  };
2956
3069
 
2957
- export { CheckBoxGroupInputView, CheckBoxInputView, CollectionView, ColorInputView, ConfigurationEditorTabView, ConfigurationEditorView, DeleteRowTableCellView, EnumTableCellView, ExtendedSelectInputView, IconTableCellView, JsonInputView, BaseObject as Object, PresenceTableCellView, ProxyUrlInputView, SelectInputView, SliderInputView, SortableCollectionView, TableCellView, TableHeaderCellView, TableRowView, TableView, TabsView, TextAreaInputView, TextInputView, TextTableCellView, TooltipView, UrlDisplayView, UrlInputView, cssModulesUtils, i18nUtils, inputView, inputWithPlaceholderText, subviewContainer, tooltipContainer };
3070
+ export { CheckBoxGroupInputView, CheckBoxInputView, CollectionView, ColorInputView, ConfigurationEditorTabView, ConfigurationEditorView, DeleteRowTableCellView, EnumTableCellView, ExtendedSelectInputView, IconTableCellView, JsonInputView, LabelOnlyView, BaseObject as Object, PresenceTableCellView, ProxyUrlInputView, SelectInputView, SeparatorView, SliderInputView, SortableCollectionView, TableCellView, TableHeaderCellView, TableRowView, TableView, TabsView, TextAreaInputView, TextInputView, TextTableCellView, TooltipView, UrlDisplayView, UrlInputView, cssModulesUtils, i18nUtils, inputView, inputWithPlaceholderText, serverSideValidation, subviewContainer, tooltipContainer, viewWithValidationErrorMessages };
@@ -1,8 +1,26 @@
1
1
  module Pageflow
2
2
  FactoryBot.define do
3
3
  factory :draft_entry, class: DraftEntry do
4
+ transient do
5
+ title
6
+ account
7
+ theming
8
+ type_name { 'paged' }
9
+ revision_attributes { {} }
10
+
11
+ with_feature { nil }
12
+ without_feature { nil }
13
+ end
14
+
4
15
  initialize_with do
5
- DraftEntry.new(create(:entry))
16
+ DraftEntry.new(create(:entry,
17
+ title: title,
18
+ account: account,
19
+ theming: theming,
20
+ type_name: type_name,
21
+ draft_attributes: revision_attributes,
22
+ with_feature: with_feature,
23
+ without_feature: without_feature))
6
24
  end
7
25
 
8
26
  to_create { |draft_entry| draft_entry.entry.save! }
@@ -21,6 +21,8 @@ module Pageflow
21
21
 
22
22
  with_feature { nil }
23
23
  without_feature { nil }
24
+
25
+ draft_attributes { nil }
24
26
  end
25
27
 
26
28
  after(:create) do |entry, evaluator|
@@ -40,6 +42,8 @@ module Pageflow
40
42
  entity: entry,
41
43
  user: evaluator.with_manager,
42
44
  role: :manager) if evaluator.with_manager
45
+
46
+ entry.draft.update!(evaluator.draft_attributes) if evaluator.draft_attributes
43
47
  end
44
48
 
45
49
  after(:build) do |entry, evaluator|
@@ -2,6 +2,9 @@ module Pageflow
2
2
  FactoryBot.define do
3
3
  factory :published_entry, class: PublishedEntry do
4
4
  transient do
5
+ title
6
+ account
7
+ theming
5
8
  type_name { 'paged' }
6
9
  revision_attributes { {} }
7
10
 
@@ -12,6 +15,9 @@ module Pageflow
12
15
  initialize_with do
13
16
  PublishedEntry.new(create(:entry,
14
17
  :published,
18
+ title: title,
19
+ account: account,
20
+ theming: theming,
15
21
  type_name: type_name,
16
22
  published_revision_attributes: revision_attributes,
17
23
  with_feature: with_feature,
Binary file