pageflow 16.0.0 → 16.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -33
- data/README.md +6 -6
- data/Rakefile +1 -1
- data/admins/pageflow/entry.rb +0 -1
- data/admins/pageflow/sites.rb +3 -0
- data/app/assets/images/pageflow/admin/icons/published_with_noindex.svg +4 -0
- data/app/assets/javascripts/pageflow/dist/ui.js +299 -72
- data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +1 -1
- data/app/assets/stylesheets/pageflow/admin/entries.scss +4 -0
- data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
- data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +4 -0
- data/app/assets/stylesheets/pageflow/editor/base.scss +0 -1
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +61 -7
- data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +12 -1
- data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
- data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
- data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -4
- data/app/assets/stylesheets/pageflow/{editor/wysihtml5.scss → ui/input/text_area_input.scss} +13 -1
- data/app/assets/stylesheets/pageflow/ui.scss +1 -0
- data/app/controllers/pageflow/chapters_controller.rb +2 -2
- data/app/controllers/pageflow/editor/entry_publications_controller.rb +5 -1
- data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
- data/app/controllers/pageflow/editor/files_controller.rb +1 -1
- data/app/controllers/pageflow/entries_controller.rb +12 -2
- data/app/controllers/pageflow/feeds_controller.rb +18 -0
- data/app/controllers/pageflow/pages_controller.rb +2 -2
- data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
- data/app/controllers/pageflow/storylines_controller.rb +2 -2
- data/app/helpers/pageflow/entries_helper.rb +4 -1
- data/app/helpers/pageflow/feeds_helper.rb +66 -0
- data/app/helpers/pageflow/meta_tags_helper.rb +2 -1
- data/app/helpers/pageflow/page_types_helper.rb +10 -10
- data/app/helpers/pageflow/revision_file_helper.rb +3 -3
- data/app/helpers/pageflow/social_share_helper.rb +2 -2
- data/app/inputs/pageflow_permalink_input.rb +15 -3
- data/app/models/concerns/pageflow/entry_publication_states.rb +9 -0
- data/app/models/concerns/pageflow/reusable_file.rb +3 -3
- data/app/models/concerns/pageflow/uploadable_file.rb +5 -0
- data/app/models/pageflow/account.rb +8 -0
- data/app/models/pageflow/audio_file_url_templates.rb +2 -1
- data/app/models/pageflow/draft_entry.rb +1 -1
- data/app/models/pageflow/entries_feed.rb +32 -0
- data/app/models/pageflow/entry.rb +7 -5
- data/app/models/pageflow/entry_at_revision.rb +2 -0
- data/app/models/pageflow/image_file.rb +34 -8
- data/app/models/pageflow/image_file_url_templates.rb +7 -1
- data/app/models/pageflow/membership.rb +3 -2
- data/app/models/pageflow/other_file.rb +5 -0
- data/app/models/pageflow/other_file_url_templates.rb +16 -0
- data/app/models/pageflow/published_entry.rb +6 -0
- data/app/models/pageflow/revision.rb +6 -0
- data/app/models/pageflow/site.rb +8 -0
- data/app/models/pageflow/sitemaps.rb +14 -0
- data/app/models/pageflow/used_file.rb +10 -2
- data/app/models/pageflow/video_file_url_templates.rb +3 -1
- data/app/models/pageflow/widget.rb +9 -1
- data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
- data/app/views/admin/sites/_attributes_table.html.arb +3 -0
- data/app/views/admin/sites/_fields.html.erb +6 -0
- data/app/views/components/pageflow/admin/extensible_attributes_table.rb +2 -2
- data/app/views/components/pageflow/admin/revisions_tab.rb +8 -0
- data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
- data/app/views/pageflow/editor/config/_seeds.json.jbuilder +2 -0
- data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
- data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
- data/app/views/pageflow/feeds/index.atom.builder +20 -0
- data/app/views/pageflow/image_files/_image_file.json.jbuilder +1 -0
- data/app/views/pageflow/meta_tags/_entry.html.erb +1 -0
- data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
- data/config/initializers/features.rb +3 -0
- data/config/initializers/paperclip.rb +8 -0
- data/config/locales/de.yml +77 -6
- data/config/locales/en.yml +79 -4
- data/config/routes.rb +3 -0
- data/config/spring.rb +1 -1
- data/db/migrate/20230120092923_create_other_files.rb +23 -0
- data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
- data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
- data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
- data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
- data/db/migrate/20231024062501_add_output_presences_to_image_files.rb +5 -0
- data/db/migrate/20231128124523_add_noindex_to_revisions.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +710 -259
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +34 -5
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
- data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
- data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +2 -1
- data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
- data/entry_types/paged/config/initializers/features.rb +0 -1
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -1
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +11 -3
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +8 -5
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +17 -12
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +1 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +7 -0
- data/entry_types/scrolled/config/initializers/features.rb +5 -0
- data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
- data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
- data/entry_types/scrolled/config/locales/de.yml +225 -8
- data/entry_types/scrolled/config/locales/en.yml +239 -2
- data/entry_types/scrolled/config/routes.rb +4 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +69 -44
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +2 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +13 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +30 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/web_app_manifest.rb +1 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +1 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
- data/entry_types/scrolled/package/config/webpack.js +26 -0
- data/entry_types/scrolled/package/contentElements-editor.js +330 -32
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +920 -145
- data/entry_types/scrolled/package/editor.js +819 -239
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-6ee0e024.js} +1975 -1792
- data/entry_types/scrolled/package/frontend/PhonePlatformContext-b28d991a.js +32 -0
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-8242f213.js +107 -0
- data/entry_types/scrolled/package/frontend/Viewer-32cd1ac1.js +154 -0
- data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-6e4d14ed.js} +32 -161
- data/entry_types/scrolled/package/frontend/arrowRight-e42e6011.js +77 -0
- data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-24363f97.js} +188 -47
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-71c39823.js} +191 -111
- data/entry_types/scrolled/package/frontend/index-fc4b13e6.js +118 -0
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +252 -76
- data/entry_types/scrolled/package/frontend/useContentElementEditorState-245f1986.js +52 -0
- data/entry_types/scrolled/package/package.json +6 -4
- data/entry_types/scrolled/package/testHelpers.js +11 -2
- data/entry_types/scrolled/package/values/colors.module.css +15 -0
- data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
- data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
- data/entry_types/scrolled/package/widgets/defaultNavigation.js +39 -4
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -0
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +49 -0
- data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -0
- data/entry_types/scrolled/package/widgets/textInlineFileRights.js +37 -0
- data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
- data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
- data/lib/generators/pageflow/resque/templates/resque.rb +1 -1
- data/lib/generators/pageflow/routes/routes_generator.rb +1 -1
- data/lib/pageflow/ability_mixin.rb +5 -5
- data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
- data/lib/pageflow/built_in_file_type.rb +7 -0
- data/lib/pageflow/configuration.rb +29 -1
- data/lib/pageflow/engine.rb +18 -40
- data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
- data/lib/pageflow/file_type.rb +2 -2
- data/lib/pageflow/global_config_api.rb +2 -2
- data/lib/pageflow/nested_revision_component.rb +23 -5
- data/lib/pageflow/page_type.rb +1 -1
- data/lib/pageflow/paperclip_processors/webp.rb +63 -0
- data/lib/pageflow/rails_version.rb +19 -0
- data/lib/pageflow/seeds.rb +10 -7
- data/lib/pageflow/user_mixin.rb +1 -1
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/widget_types.rb +4 -0
- data/package/config/jest/index.js +3 -1
- data/package/config/webpack5.js +14 -0
- data/package/editor.js +410 -181
- data/package/frontend.js +34 -4
- data/package/testHelpers.js +1 -1
- data/package/ui.js +297 -71
- data/spec/factories/entries.rb +34 -3
- data/spec/factories/sites.rb +3 -0
- data/vendor/assets/javascripts/iscroll.js +4 -7
- metadata +118 -80
- data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
- data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
@@ -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
|
@@ -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
|
-
|
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.
|
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(
|
38
|
+
chapters.find(id).update(storyline_id: storyline.id, position: index)
|
39
39
|
end
|
40
40
|
|
41
41
|
head :no_content
|
data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb
CHANGED
@@ -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.
|
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
|
-
|
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.
|
9
|
+
section = chapter.create_section(section_params)
|
10
10
|
|
11
|
-
render partial: 'pageflow_scrolled/sections/
|
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.
|
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
|
-
|
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
|
-
|
15
|
-
@widget_scope = get_entry_mode_from_env
|
16
|
+
entry = get_published_entry_from_env
|
16
17
|
|
17
|
-
I18n.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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
28
|
-
|
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
|
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)
|
data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb
CHANGED
@@ -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
|
-
|
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("
|
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
|
-
<%=
|
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) %>
|
@@ -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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<
|
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
|
-
|
7
|
-
|
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
|
-
|
11
|
-
|
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
|
-
|
15
|
+
<%= scrolled_favicons_for_entry(entry, entry_mode: widget_scope) %>
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
<%= javascript_include_tag 'pageflow_scrolled/legacy' %>
|
18
|
+
<%= scrolled_frontend_stylesheet_packs_tag(entry, widget_scope: widget_scope) %>
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
<%= scrolled_theme_properties_style_tag(entry.theme) %>
|
21
|
+
<%= scrolled_theme_stylesheet_pack_tags(entry.theme) %>
|
20
22
|
|
21
|
-
|
23
|
+
<%= render_widget_head_fragments(entry, scope: widget_scope) %>
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
</script>
|
33
|
-
<% end %>
|
34
|
+
</script>
|
35
|
+
<% end %>
|
34
36
|
|
35
|
-
|
37
|
+
<% ssr_html = local_assigns[:skip_ssr] ? '' : render_scrolled_entry(entry) %>
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
46
|
+
<%= render 'pageflow_scrolled/entries/global_notices' %>
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
+
<div id="fullscreenRoot"></div>
|
49
|
+
<div id="root"><%= ssr_html %></div>
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
<div id='template-widget-container'>
|
52
|
+
<%= render_widgets(entry, scope: widget_scope, insert_point: :bottom_of_entry) %>
|
53
|
+
</div>
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
<%= scrolled_webpack_public_path_script_tag %>
|
56
|
+
<%= scrolled_frontend_javascript_packs_tag(entry, widget_scope: widget_scope) %>
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
<%= scrolled_entry_json_seed_script_tag(entry, local_assigns[:seed_options] || {}) %>
|
59
|
+
</body>
|
60
|
+
<% end %>
|
58
61
|
<% end %>
|
data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder
ADDED
@@ -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]
|