pageflow 16.0.0 → 16.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -33
  3. data/README.md +6 -6
  4. data/Rakefile +1 -1
  5. data/admins/pageflow/entry.rb +0 -1
  6. data/admins/pageflow/sites.rb +3 -0
  7. data/app/assets/images/pageflow/admin/icons/published_with_noindex.svg +4 -0
  8. data/app/assets/javascripts/pageflow/dist/ui.js +299 -72
  9. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +1 -1
  10. data/app/assets/stylesheets/pageflow/admin/entries.scss +4 -0
  11. data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
  12. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +4 -0
  13. data/app/assets/stylesheets/pageflow/editor/base.scss +0 -1
  14. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +61 -7
  15. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +12 -1
  16. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
  17. data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
  18. data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
  19. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
  20. data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -4
  21. data/app/assets/stylesheets/pageflow/{editor/wysihtml5.scss → ui/input/text_area_input.scss} +13 -1
  22. data/app/assets/stylesheets/pageflow/ui.scss +1 -0
  23. data/app/controllers/pageflow/chapters_controller.rb +2 -2
  24. data/app/controllers/pageflow/editor/entry_publications_controller.rb +5 -1
  25. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  26. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  27. data/app/controllers/pageflow/entries_controller.rb +12 -2
  28. data/app/controllers/pageflow/feeds_controller.rb +18 -0
  29. data/app/controllers/pageflow/pages_controller.rb +2 -2
  30. data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
  31. data/app/controllers/pageflow/storylines_controller.rb +2 -2
  32. data/app/helpers/pageflow/entries_helper.rb +4 -1
  33. data/app/helpers/pageflow/feeds_helper.rb +66 -0
  34. data/app/helpers/pageflow/meta_tags_helper.rb +2 -1
  35. data/app/helpers/pageflow/page_types_helper.rb +10 -10
  36. data/app/helpers/pageflow/revision_file_helper.rb +3 -3
  37. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  38. data/app/inputs/pageflow_permalink_input.rb +15 -3
  39. data/app/models/concerns/pageflow/entry_publication_states.rb +9 -0
  40. data/app/models/concerns/pageflow/reusable_file.rb +3 -3
  41. data/app/models/concerns/pageflow/uploadable_file.rb +5 -0
  42. data/app/models/pageflow/account.rb +8 -0
  43. data/app/models/pageflow/audio_file_url_templates.rb +2 -1
  44. data/app/models/pageflow/draft_entry.rb +1 -1
  45. data/app/models/pageflow/entries_feed.rb +32 -0
  46. data/app/models/pageflow/entry.rb +7 -5
  47. data/app/models/pageflow/entry_at_revision.rb +2 -0
  48. data/app/models/pageflow/image_file.rb +34 -8
  49. data/app/models/pageflow/image_file_url_templates.rb +7 -1
  50. data/app/models/pageflow/membership.rb +3 -2
  51. data/app/models/pageflow/other_file.rb +5 -0
  52. data/app/models/pageflow/other_file_url_templates.rb +16 -0
  53. data/app/models/pageflow/published_entry.rb +6 -0
  54. data/app/models/pageflow/revision.rb +6 -0
  55. data/app/models/pageflow/site.rb +8 -0
  56. data/app/models/pageflow/sitemaps.rb +14 -0
  57. data/app/models/pageflow/used_file.rb +10 -2
  58. data/app/models/pageflow/video_file_url_templates.rb +3 -1
  59. data/app/models/pageflow/widget.rb +9 -1
  60. data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
  61. data/app/views/admin/sites/_attributes_table.html.arb +3 -0
  62. data/app/views/admin/sites/_fields.html.erb +6 -0
  63. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +2 -2
  64. data/app/views/components/pageflow/admin/revisions_tab.rb +8 -0
  65. data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
  66. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +2 -0
  67. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
  68. data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
  69. data/app/views/pageflow/feeds/index.atom.builder +20 -0
  70. data/app/views/pageflow/image_files/_image_file.json.jbuilder +1 -0
  71. data/app/views/pageflow/meta_tags/_entry.html.erb +1 -0
  72. data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
  73. data/config/initializers/features.rb +3 -0
  74. data/config/initializers/paperclip.rb +8 -0
  75. data/config/locales/de.yml +77 -6
  76. data/config/locales/en.yml +79 -4
  77. data/config/routes.rb +3 -0
  78. data/config/spring.rb +1 -1
  79. data/db/migrate/20230120092923_create_other_files.rb +23 -0
  80. data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
  81. data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
  82. data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
  83. data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
  84. data/db/migrate/20231024062501_add_output_presences_to_image_files.rb +5 -0
  85. data/db/migrate/20231128124523_add_noindex_to_revisions.rb +5 -0
  86. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +710 -259
  87. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +34 -5
  88. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  89. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  90. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
  91. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +2 -1
  92. data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
  93. data/entry_types/paged/config/initializers/features.rb +0 -1
  94. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -1
  95. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  96. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
  97. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
  98. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +11 -3
  99. data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
  100. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
  101. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +8 -5
  102. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +17 -12
  103. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
  104. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +1 -1
  105. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
  106. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -1
  107. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
  108. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
  109. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
  110. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
  111. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +7 -0
  112. data/entry_types/scrolled/config/initializers/features.rb +5 -0
  113. data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
  114. data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
  115. data/entry_types/scrolled/config/locales/de.yml +225 -8
  116. data/entry_types/scrolled/config/locales/en.yml +239 -2
  117. data/entry_types/scrolled/config/routes.rb +4 -0
  118. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +69 -44
  119. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +2 -1
  120. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
  121. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
  122. data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
  123. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +13 -1
  124. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +30 -0
  125. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
  126. data/entry_types/scrolled/lib/pageflow_scrolled/web_app_manifest.rb +1 -1
  127. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +1 -1
  128. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
  129. data/entry_types/scrolled/package/config/webpack.js +26 -0
  130. data/entry_types/scrolled/package/contentElements-editor.js +330 -32
  131. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  132. data/entry_types/scrolled/package/contentElements-frontend.js +920 -145
  133. data/entry_types/scrolled/package/editor.js +819 -239
  134. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-6ee0e024.js} +1975 -1792
  135. data/entry_types/scrolled/package/frontend/PhonePlatformContext-b28d991a.js +32 -0
  136. data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-8242f213.js +107 -0
  137. data/entry_types/scrolled/package/frontend/Viewer-32cd1ac1.js +154 -0
  138. data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-6e4d14ed.js} +32 -161
  139. data/entry_types/scrolled/package/frontend/arrowRight-e42e6011.js +77 -0
  140. data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-24363f97.js} +188 -47
  141. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-71c39823.js} +191 -111
  142. data/entry_types/scrolled/package/frontend/index-fc4b13e6.js +118 -0
  143. data/entry_types/scrolled/package/frontend/index.css +1 -1
  144. data/entry_types/scrolled/package/frontend/index.js +252 -76
  145. data/entry_types/scrolled/package/frontend/useContentElementEditorState-245f1986.js +52 -0
  146. data/entry_types/scrolled/package/package.json +6 -4
  147. data/entry_types/scrolled/package/testHelpers.js +11 -2
  148. data/entry_types/scrolled/package/values/colors.module.css +15 -0
  149. data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
  150. data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
  151. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  152. data/entry_types/scrolled/package/widgets/defaultNavigation.js +39 -4
  153. data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -0
  154. data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +49 -0
  155. data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -0
  156. data/entry_types/scrolled/package/widgets/textInlineFileRights.js +37 -0
  157. data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
  158. data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
  159. data/lib/generators/pageflow/resque/templates/resque.rb +1 -1
  160. data/lib/generators/pageflow/routes/routes_generator.rb +1 -1
  161. data/lib/pageflow/ability_mixin.rb +5 -5
  162. data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
  163. data/lib/pageflow/built_in_file_type.rb +7 -0
  164. data/lib/pageflow/configuration.rb +29 -1
  165. data/lib/pageflow/engine.rb +18 -40
  166. data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
  167. data/lib/pageflow/file_type.rb +2 -2
  168. data/lib/pageflow/global_config_api.rb +2 -2
  169. data/lib/pageflow/nested_revision_component.rb +23 -5
  170. data/lib/pageflow/page_type.rb +1 -1
  171. data/lib/pageflow/paperclip_processors/webp.rb +63 -0
  172. data/lib/pageflow/rails_version.rb +19 -0
  173. data/lib/pageflow/seeds.rb +10 -7
  174. data/lib/pageflow/user_mixin.rb +1 -1
  175. data/lib/pageflow/version.rb +1 -1
  176. data/lib/pageflow/widget_types.rb +4 -0
  177. data/package/config/jest/index.js +3 -1
  178. data/package/config/webpack5.js +14 -0
  179. data/package/editor.js +410 -181
  180. data/package/frontend.js +34 -4
  181. data/package/testHelpers.js +1 -1
  182. data/package/ui.js +297 -71
  183. data/spec/factories/entries.rb +34 -3
  184. data/spec/factories/sites.rb +3 -0
  185. data/vendor/assets/javascripts/iscroll.js +4 -7
  186. metadata +118 -80
  187. data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
  188. data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
@@ -6,8 +6,6 @@ module PageflowPaged
6
6
 
7
7
  skip_before_action :verify_edit_lock, only: :partials
8
8
 
9
- helper_method :render_to_string
10
-
11
9
  def partials
12
10
  I18n.locale = @entry.locale
13
11
  render action: 'partials', layout: false
@@ -4,6 +4,7 @@ module PageflowPaged
4
4
  include Pageflow::EntriesControllerEnvHelper
5
5
  include WithoutControllerNamespacePartialPathPrefix
6
6
 
7
+ helper Pageflow::FeedsHelper
7
8
  helper Pageflow::MetaTagsHelper
8
9
  helper Pageflow::StructuredDataHelper
9
10
  helper Pageflow::PublicI18nHelper
@@ -16,7 +17,7 @@ module PageflowPaged
16
17
 
17
18
  @entry.share_target =
18
19
  if params[:page].present?
19
- @entry.pages.find_by_perma_id(params[:page])
20
+ @entry.pages.find_by_perma_id(params[:page]) || @entry
20
21
  else
21
22
  @entry
22
23
  end
@@ -12,6 +12,7 @@
12
12
 
13
13
  <%= tag :link, :rel => 'icon', :href => image_path("pageflow/themes/#{@entry.theme.directory_name}/favicon.ico"), :type => 'image/ico' %>
14
14
  <%= meta_tags_for_entry(@entry) %>
15
+ <%= feed_link_tags_for_entry(@entry) %>
15
16
  <% end %>
16
17
  <% end %>
17
18
 
@@ -2,7 +2,6 @@ Pageflow.configure do |config|
2
2
  config.for_entry_type(PageflowPaged.entry_type) do |entry_type_config|
3
3
  entry_type_config.features.register('highdef_background_images')
4
4
  entry_type_config.features.register('force_best_video_quality')
5
- entry_type_config.features.register('force_fullhd_video_quality')
6
5
 
7
6
  entry_type_config.features.register('auto_change_page')
8
7
  entry_type_config.features.register('delayed_text_fade_in')
@@ -1,9 +1,21 @@
1
+ require 'pageflow/rails_version'
2
+
1
3
  module PageflowPaged
2
4
  # Rails integration
3
5
  class Engine < ::Rails::Engine
4
6
  isolate_namespace PageflowPaged
5
7
 
6
- config.paths.add('lib', eager_load: true)
8
+ lib = root.join('lib')
9
+
10
+ config.autoload_paths << lib
11
+ config.eager_load_paths << lib
12
+
13
+ initializer 'pageflow_paged.autoloading' do
14
+ Rails.autoloaders.main.ignore(
15
+ lib.join('tasks')
16
+ )
17
+ end
18
+
7
19
  config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
8
20
 
9
21
  initializer 'pageflow_paged.assets.precompile' do |app|
@@ -14,7 +14,7 @@ module PageflowScrolled
14
14
 
15
15
  def update
16
16
  chapter = Chapter.all_for_revision(@entry.draft).find(params[:id])
17
- chapter.update_attributes(chapter_params)
17
+ chapter.update(chapter_params)
18
18
 
19
19
  head :no_content
20
20
  rescue ActiveRecord::RecordNotFound
@@ -35,7 +35,7 @@ module PageflowScrolled
35
35
  chapters = Chapter.all_for_revision(@entry.draft)
36
36
 
37
37
  params.require(:ids).each_with_index do |id, index|
38
- chapters.update(id, storyline_id: storyline.id, position: index)
38
+ chapters.find(id).update(storyline_id: storyline.id, position: index)
39
39
  end
40
40
 
41
41
  head :no_content
@@ -27,7 +27,7 @@ module PageflowScrolled
27
27
 
28
28
  def update
29
29
  content_element = ContentElement.all_for_revision(@entry.draft).find(params[:id])
30
- content_element.update_attributes(content_element_params)
30
+ content_element.update(content_element_params)
31
31
 
32
32
  head :no_content
33
33
  rescue ActiveRecord::RecordNotFound
@@ -48,9 +48,8 @@ module PageflowScrolled
48
48
  storyline = section.chapter.storyline
49
49
 
50
50
  params.require(:ids).each_with_index do |id, index|
51
- storyline.content_elements.update(id,
52
- section_id: section.id,
53
- position: index)
51
+ storyline.content_elements.find(id).update(section_id: section.id,
52
+ position: index)
54
53
  end
55
54
 
56
55
  head :no_content
@@ -6,16 +6,24 @@ module PageflowScrolled
6
6
 
7
7
  def create
8
8
  chapter = Chapter.all_for_revision(@entry.draft).find(params[:chapter_id])
9
- section = chapter.sections.create(section_params)
9
+ section = chapter.create_section(section_params)
10
10
 
11
- render partial: 'pageflow_scrolled/sections/section',
11
+ render partial: 'pageflow_scrolled/editor/sections/section_with_content_elements',
12
12
  locals: {section: section},
13
13
  status: :created
14
14
  end
15
15
 
16
+ def duplicate
17
+ section = Section.all_for_revision(@entry.draft).find(params[:id])
18
+
19
+ render partial: 'pageflow_scrolled/editor/sections/section_with_content_elements',
20
+ locals: {section: section.chapter.duplicate_section(section)},
21
+ status: :created
22
+ end
23
+
16
24
  def update
17
25
  section = Section.all_for_revision(@entry.draft).find(params[:id])
18
- section.update_attributes(section_params)
26
+ section.update(section_params)
19
27
 
20
28
  head :no_content
21
29
  rescue ActiveRecord::RecordNotFound
@@ -36,9 +44,8 @@ module PageflowScrolled
36
44
  storyline = chapter.storyline
37
45
 
38
46
  params.require(:ids).each_with_index do |id, index|
39
- storyline.sections.update(id,
40
- chapter_id: chapter.id,
41
- position: index)
47
+ storyline.sections.find(id).update(chapter_id: chapter.id,
48
+ position: index)
42
49
  end
43
50
 
44
51
  head :no_content
@@ -4,17 +4,25 @@ module PageflowScrolled
4
4
  include Pageflow::EntriesControllerEnvHelper
5
5
 
6
6
  helper Pageflow::EntriesHelper
7
+ helper Pageflow::FeedsHelper
7
8
  helper Pageflow::WidgetsHelper
8
9
  helper Pageflow::SocialShareHelper
9
10
  helper Pageflow::MetaTagsHelper
10
11
  helper Pageflow::StructuredDataHelper
12
+ helper Pageflow::TextDirectionHelper
11
13
  helper FaviconHelper
12
14
 
13
15
  def show
14
- @entry = get_published_entry_from_env
15
- @widget_scope = get_entry_mode_from_env
16
+ entry = get_published_entry_from_env
16
17
 
17
- I18n.locale = @entry.locale
18
+ I18n.locale = entry.locale
19
+
20
+ render(
21
+ locals: {
22
+ entry: entry,
23
+ widget_scope: get_entry_mode_from_env
24
+ }
25
+ )
18
26
  end
19
27
  end
20
28
  end
@@ -0,0 +1,11 @@
1
+ module PageflowScrolled
2
+ # @api private
3
+ module CacheHelper
4
+ def cache_scrolled_entry(entry:, widget_scope:, &block)
5
+ condition =
6
+ widget_scope == :published &&
7
+ entry.feature_state('scrolled_entry_fragment_caching')
8
+ cache_if(condition, [entry, :head_and_body, widget_scope], &block)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,42 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # Render editor seed data for scrolled entries.
4
+ #
5
+ # @api private
6
+ module EntryJsonSeedHelper
7
+ include PageflowScrolled::EntryJsonSeedHelper
8
+
9
+ def scrolled_entry_editor_json_seed(json, scrolled_entry)
10
+ json.key_format!(camelize: :lower)
11
+ entry_config = Pageflow.config_for(scrolled_entry)
12
+
13
+ scrolled_entry_editor_legacy_typography_variants_seed(json, entry_config)
14
+ scrolled_entry_editor_consent_vendor_host_matchers_seed(json, entry_config)
15
+
16
+ scrolled_entry_json_seed(json,
17
+ scrolled_entry,
18
+ skip_files: true,
19
+ skip_i18n: true,
20
+ include_unused_additional_seed_data: true)
21
+ end
22
+
23
+ private
24
+
25
+ def scrolled_entry_editor_legacy_typography_variants_seed(json, entry_config)
26
+ json.legacy_typography_variants(
27
+ entry_config
28
+ .legacy_typography_variants
29
+ .deep_transform_keys { |key| key.to_s.camelize(:lower) }
30
+ )
31
+ end
32
+
33
+ def scrolled_entry_editor_consent_vendor_host_matchers_seed(json, entry_config)
34
+ json.consent_vendor_host_matchers(
35
+ entry_config
36
+ .consent_vendor_host_matchers
37
+ .transform_keys { |regexp| regexp.inspect[1..-2] }
38
+ )
39
+ end
40
+ end
41
+ end
42
+ end
@@ -6,6 +6,8 @@ module PageflowScrolled
6
6
  include ReactServerSideRenderingHelper
7
7
  include Pageflow::WidgetsHelper
8
8
  include Pageflow::StructuredDataHelper
9
+ include Pageflow::TextDirectionHelper
10
+ include PageflowScrolled::CacheHelper
9
11
  include FaviconHelper
10
12
  include PacksHelper
11
13
  include WebpackPublicPathHelper
@@ -13,11 +15,12 @@ module PageflowScrolled
13
15
  def scrolled_editor_iframe_seed_html_script_tag(entry)
14
16
  html = render(template: 'pageflow_scrolled/entries/show',
15
17
  locals: {
16
- :@entry => entry,
17
- :@widget_scope => :editor,
18
- :@skip_ssr => true,
19
- :@skip_structured_data => true,
20
- :@seed_options => {
18
+ entry: entry,
19
+ widget_scope: :editor,
20
+ skip_ssr: true,
21
+ skip_structured_data: true,
22
+ skip_feed_link_tags: true,
23
+ seed_options: {
21
24
  skip_collections: true,
22
25
  include_unused_additional_seed_data: true,
23
26
  translations: {include_inline_editing: true}
@@ -2,40 +2,41 @@ module PageflowScrolled
2
2
  # @api private
3
3
  module PacksHelper
4
4
  def scrolled_frontend_javascript_packs_tag(entry, options)
5
- javascript_packs_with_chunks_tag(
6
- *scrolled_frontend_packs(entry, options)
5
+ javascript_pack_tag(
6
+ *scrolled_frontend_packs(entry, **options),
7
+ defer: false
7
8
  )
8
9
  end
9
10
 
10
11
  def scrolled_frontend_stylesheet_packs_tag(entry, options)
11
- stylesheet_packs_with_chunks_tag(
12
- *scrolled_frontend_packs(entry, options),
12
+ stylesheet_pack_tag(
13
+ *scrolled_frontend_packs(entry, **options),
13
14
  media: 'all'
14
15
  )
15
16
  end
16
17
 
17
18
  def scrolled_editor_javascript_packs_tag(entry)
18
- javascript_packs_with_chunks_tag(
19
- *scrolled_editor_packs(entry)
19
+ javascript_pack_tag(
20
+ *scrolled_editor_packs(entry),
21
+ defer: false
20
22
  )
21
23
  end
22
24
 
23
25
  def scrolled_frontend_packs(entry, widget_scope:)
24
- widget_types = scrolled_frontend_pack_widget_types(entry, widget_scope)
25
-
26
26
  ['pageflow-scrolled-frontend'] +
27
- scrolled_frontend_content_element_packs(entry, widget_scope) +
28
- widget_types.map(&:pack)
27
+ scrolled_additional_frontend_packs(entry, widget_scope) +
28
+ scrolled_frontend_widget_type_packs(entry, widget_scope)
29
29
  end
30
30
 
31
31
  def scrolled_editor_packs(entry)
32
32
  ['pageflow-scrolled-editor'] +
33
- Pageflow.config_for(entry).additional_editor_packs.paths
33
+ Pageflow.config_for(entry).additional_editor_packs.paths +
34
+ scrolled_frontend_widget_type_packs(entry, :editor)
34
35
  end
35
36
 
36
37
  private
37
38
 
38
- def scrolled_frontend_content_element_packs(entry, widget_scope)
39
+ def scrolled_additional_frontend_packs(entry, widget_scope)
39
40
  additional_packs = Pageflow.config_for(entry).additional_frontend_packs
40
41
  return additional_packs.paths if widget_scope == :editor
41
42
 
@@ -47,6 +48,10 @@ module PageflowScrolled
47
48
  )
48
49
  end
49
50
 
51
+ def scrolled_frontend_widget_type_packs(entry, widget_scope)
52
+ scrolled_frontend_pack_widget_types(entry, widget_scope).map(&:pack)
53
+ end
54
+
50
55
  def scrolled_frontend_pack_widget_types(entry, widget_scope)
51
56
  if widget_scope == :editor
52
57
  ReactWidgetType.all_for(entry)
@@ -32,6 +32,9 @@ module PageflowScrolled
32
32
 
33
33
  # see https://github.com/reactjs/react-rails/issues/970#issuecomment-476338244
34
34
  class WebpackerSplitChunksManifestContainer < React::ServerRendering::WebpackerManifestContainer
35
+ CLIENT_EXEC =
36
+ %r{__webpack_exec__\("./node_modules/webpack-dev-server\/client\/index\.js[^"]*"\),}
37
+
35
38
  def find_asset(logical_path)
36
39
  asset_paths = manifest.lookup_pack_with_chunks(logical_path, type: :javascript)
37
40
 
@@ -46,7 +49,12 @@ module PageflowScrolled
46
49
  asset_path.slice!("#{ds.protocol}://#{ds.host_with_port}")
47
50
  dev_server_asset =
48
51
  URI.open("#{ds.protocol}://#{ds.host_with_port}#{asset_path}").read
49
- dev_server_asset.sub!(CLIENT_REQUIRE, '//\0')
52
+
53
+ # Remove webpack-dev-server client code that tries to
54
+ # interact with browser globals:
55
+ dev_server_asset.sub!(CLIENT_REQUIRE, '//\0') # for Webpack 4
56
+ dev_server_asset.sub!(CLIENT_EXEC, '/*\0*/') # for Webpack 5
57
+
50
58
  dev_server_asset
51
59
  end
52
60
  else
@@ -8,7 +8,7 @@ module PageflowScrolled
8
8
  relative_url: false)
9
9
  path =
10
10
  theme.files.dig(theme_file_role, theme_file_style) ||
11
- asset_pack_path("media/pageflow-scrolled/themes/#{theme.name}/#{path}")
11
+ asset_pack_path("static/pageflow-scrolled/themes/#{theme.name}/#{path}")
12
12
 
13
13
  if relative_url
14
14
  URI.parse(path).path
@@ -16,6 +16,23 @@ module PageflowScrolled
16
16
  attr_accessor :revision # used on :create to lazily create storyline
17
17
  before_validation :ensure_storyline, on: :create
18
18
 
19
+ def create_section(attributes = {})
20
+ shift_section_positions(from: attributes[:position])
21
+
22
+ section = sections.create!(attributes)
23
+ section.content_elements.create!(type_name: 'textBlock')
24
+
25
+ section
26
+ end
27
+
28
+ def duplicate_section(section)
29
+ shift_section_positions(from: section.position + 1)
30
+
31
+ section.duplicate do |new_section|
32
+ new_section.position = section.position + 1
33
+ end
34
+ end
35
+
19
36
  def self.all_for_revision(revision)
20
37
  joins(storyline: :revision)
21
38
  .where(pageflow_scrolled_storylines: {revision_id: revision})
@@ -23,6 +40,12 @@ module PageflowScrolled
23
40
 
24
41
  private
25
42
 
43
+ def shift_section_positions(from:)
44
+ sections
45
+ .where('position >= ?', from)
46
+ .update_all('position = position + 1')
47
+ end
48
+
26
49
  def ensure_storyline
27
50
  return if storyline.present?
28
51
  unless Storyline.all_for_revision(revision).exists?
@@ -1,5 +1,5 @@
1
1
  <%= stylesheet_link_tag 'pageflow_paged/editor', media: 'all' %>
2
- <%= stylesheet_packs_with_chunks_tag 'pageflow-scrolled-frontend' %>
2
+ <%= stylesheet_pack_tag 'pageflow-scrolled-frontend' %>
3
3
 
4
4
  <%= scrolled_theme_properties_style_tag(entry.theme) %>
5
5
  <%= scrolled_theme_stylesheet_pack_tags(entry.theme) %>
@@ -1,5 +1 @@
1
- scrolled_entry_json_seed(json,
2
- entry,
3
- skip_files: true,
4
- skip_i18n: true,
5
- include_unused_additional_seed_data: true)
1
+ scrolled_entry_editor_json_seed(json, entry)
@@ -0,0 +1,10 @@
1
+ json.key_format!(camelize: :lower)
2
+
3
+ json.partial! 'pageflow_scrolled/sections/section', section: section
4
+
5
+ json.content_elements do
6
+ json.array!(section.content_elements) do |content_element|
7
+ json.partial! 'pageflow_scrolled/content_elements/content_element',
8
+ content_element: content_element
9
+ end
10
+ end
@@ -1,58 +1,61 @@
1
- <!DOCTYPE html>
2
- <%= content_tag(:html, lang: @entry.locale) do %>
3
- <head>
4
- <title><%= pretty_entry_title(@entry) %></title>
1
+ <%= cache_scrolled_entry(entry: entry, widget_scope: widget_scope) do %>
2
+ <!DOCTYPE html>
3
+ <%= content_tag(:html, lang: entry.locale, dir: text_direction(entry.locale)) do %>
4
+ <head>
5
+ <title><%= pretty_entry_title(entry) %></title>
5
6
 
6
- <meta charset="utf-8" />
7
- <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <meta charset="utf-8" />
8
+ <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
8
9
 
9
10
 
10
- <%= social_share_meta_tags_for(@entry) %>
11
- <%= meta_tags_for_entry(@entry) %>
11
+ <%= social_share_meta_tags_for(entry) %>
12
+ <%= meta_tags_for_entry(entry) %>
13
+ <%= feed_link_tags_for_entry(entry) unless local_assigns[:skip_feed_link_tags] %>
12
14
 
13
- <%= scrolled_favicons_for_entry(@entry, entry_mode: @widget_scope) %>
15
+ <%= scrolled_favicons_for_entry(entry, entry_mode: widget_scope) %>
14
16
 
15
- <%= javascript_include_tag 'pageflow_scrolled/legacy' %>
16
- <%= scrolled_frontend_stylesheet_packs_tag(@entry, widget_scope: @widget_scope) %>
17
+ <%= javascript_include_tag 'pageflow_scrolled/legacy' %>
18
+ <%= scrolled_frontend_stylesheet_packs_tag(entry, widget_scope: widget_scope) %>
17
19
 
18
- <%= scrolled_theme_properties_style_tag(@entry.theme) %>
19
- <%= scrolled_theme_stylesheet_pack_tags(@entry.theme) %>
20
+ <%= scrolled_theme_properties_style_tag(entry.theme) %>
21
+ <%= scrolled_theme_stylesheet_pack_tags(entry.theme) %>
20
22
 
21
- <%= render_widget_head_fragments(@entry, scope: @widget_scope) %>
23
+ <%= render_widget_head_fragments(entry, scope: widget_scope) %>
22
24
 
23
- <% if Rails.env.development? %>
24
- <script>
25
- try {
26
- if (window.top !== window) {
27
- window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.top.__REACT_DEVTOOLS_GLOBAL_HOOK__;
25
+ <% if Rails.env.development? %>
26
+ <script>
27
+ try {
28
+ if (window.top !== window) {
29
+ window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.top.__REACT_DEVTOOLS_GLOBAL_HOOK__;
30
+ }
31
+ } catch (e) {
32
+ console.warn('unable to connect to top frame for connecting dev tools');
28
33
  }
29
- } catch (e) {
30
- console.warn('unable to connect to top frame for connecting dev tools');
31
- }
32
- </script>
33
- <% end %>
34
+ </script>
35
+ <% end %>
34
36
 
35
- <% ssr_html = @skip_ssr ? '' : render_scrolled_entry(@entry) %>
37
+ <% ssr_html = local_assigns[:skip_ssr] ? '' : render_scrolled_entry(entry) %>
36
38
 
37
- <% if !@skip_ssr && (params[:frontend] == 'v2' || @entry.feature_state('frontend_v2')) %>
38
- <%= generated_media_queries_tags_for(ssr_html) %>
39
- <% end %>
40
- </head>
41
- <body>
42
- <%= structured_data_for_entry(@entry) unless @skip_structured_data %>
39
+ <% if !local_assigns[:skip_ssr] && (params[:frontend] == 'v2' || entry.feature_state('frontend_v2')) %>
40
+ <%= generated_media_queries_tags_for(ssr_html) %>
41
+ <% end %>
42
+ </head>
43
+ <body>
44
+ <%= structured_data_for_entry(entry) unless local_assigns[:skip_structured_data] %>
43
45
 
44
- <%= render 'pageflow_scrolled/entries/global_notices' %>
46
+ <%= render 'pageflow_scrolled/entries/global_notices' %>
45
47
 
46
- <div id="fullscreenRoot"></div>
47
- <div id="root"><%= ssr_html %></div>
48
+ <div id="fullscreenRoot"></div>
49
+ <div id="root"><%= ssr_html %></div>
48
50
 
49
- <div id='template-widget-container'>
50
- <%= render_widgets(@entry, scope: @widget_scope, insert_point: :bottom_of_entry) %>
51
- </div>
51
+ <div id='template-widget-container'>
52
+ <%= render_widgets(entry, scope: widget_scope, insert_point: :bottom_of_entry) %>
53
+ </div>
52
54
 
53
- <%= scrolled_webpack_public_path_script_tag %>
54
- <%= scrolled_frontend_javascript_packs_tag(@entry, widget_scope: @widget_scope) %>
55
+ <%= scrolled_webpack_public_path_script_tag %>
56
+ <%= scrolled_frontend_javascript_packs_tag(entry, widget_scope: widget_scope) %>
55
57
 
56
- <%= scrolled_entry_json_seed_script_tag(@entry, @seed_options || {}) %>
57
- </body>
58
+ <%= scrolled_entry_json_seed_script_tag(entry, local_assigns[:seed_options] || {}) %>
59
+ </body>
60
+ <% end %>
58
61
  <% end %>
@@ -0,0 +1,16 @@
1
+ content_element_vendors =
2
+ entry_config.content_element_consent_vendors.by_content_element_id(entry)
3
+
4
+ json.content_element_consent_vendors(content_element_vendors)
5
+
6
+ I18n.with_locale(entry.locale) do
7
+ json.consent_vendors do
8
+ json.array!(content_element_vendors.values.uniq) do |name|
9
+ json.name name
10
+ json.display_name t("pageflow_scrolled.consent_vendors.#{name}.name")
11
+ json.description t("pageflow_scrolled.consent_vendors.#{name}.description")
12
+ json.opt_in_prompt t("pageflow_scrolled.consent_vendors.#{name}.opt_in_prompt")
13
+ json.paradigm 'lazy opt-in'
14
+ end
15
+ end
16
+ end
@@ -39,6 +39,13 @@ json.config do
39
39
  self,
40
40
  include_unused: options[:include_unused_additional_seed_data])
41
41
  )
42
+
43
+ json.partial! 'pageflow_scrolled/entry_json_seed/consent_vendors',
44
+ entry: entry, entry_config: entry_config
45
+
46
+ json.file_licenses(
47
+ I18n.t('pageflow.file_licenses', default: {}).slice(*entry_config.available_file_licenses)
48
+ )
42
49
  end
43
50
 
44
51
  unless options[:skip_i18n]
@@ -0,0 +1,5 @@
1
+ Pageflow.configure do |config|
2
+ config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
3
+ entry_type_config.features.register('hls_instead_of_dash')
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ de:
2
+ pageflow:
3
+ consentBar:
4
+ widget_type_name: "Consent-Leiste"
@@ -0,0 +1,4 @@
1
+ en:
2
+ pageflow:
3
+ consentBar:
4
+ widget_type_name: "Consent bar"