pageflow 15.1.0.beta2 → 15.1.0.beta3

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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +141 -1
  3. data/README.md +3 -6
  4. data/admins/pageflow/entry.rb +1 -1
  5. data/app/assets/javascripts/pageflow/dist/editor.js +1241 -1281
  6. data/app/assets/javascripts/pageflow/dist/react-client.js +3 -3
  7. data/app/assets/javascripts/pageflow/dist/react-server.js +2 -2
  8. data/app/assets/javascripts/pageflow/dist/ui.js +241 -57
  9. data/app/assets/javascripts/pageflow/editor/base.js +0 -20
  10. data/app/assets/javascripts/pageflow/editor/vendor.js +16 -0
  11. data/app/assets/stylesheets/pageflow/admin/embedded_index_table.scss +5 -1
  12. data/app/controllers/concerns/pageflow/controller_delegation.rb +31 -0
  13. data/app/controllers/concerns/pageflow/entry_password_protection.rb +4 -4
  14. data/app/controllers/pageflow/editor/entries_controller.rb +35 -0
  15. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  16. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  17. data/app/controllers/pageflow/entries_controller.rb +29 -71
  18. data/app/controllers/pageflow/revisions_controller.rb +16 -5
  19. data/app/helpers/pageflow/common_entry_seed_helper.rb +9 -24
  20. data/app/helpers/pageflow/config_helper.rb +25 -3
  21. data/app/helpers/pageflow/editor/config_helper.rb +12 -0
  22. data/app/helpers/pageflow/editor/entries_helper.rb +10 -0
  23. data/app/helpers/pageflow/editor/files_helper.rb +24 -0
  24. data/app/helpers/pageflow/entries_helper.rb +5 -4
  25. data/app/helpers/pageflow/entry_json_seed_helper.rb +1 -0
  26. data/app/helpers/pageflow/files_helper.rb +14 -13
  27. data/app/helpers/pageflow/page_types_helper.rb +4 -1
  28. data/app/helpers/pageflow/render_json_helper.rb +30 -5
  29. data/app/models/concerns/pageflow/auto_generated_perma_id.rb +16 -0
  30. data/app/models/concerns/pageflow/feature_target.rb +3 -3
  31. data/app/models/pageflow/draft_entry.rb +3 -0
  32. data/app/models/pageflow/home_button.rb +3 -1
  33. data/app/models/pageflow/page.rb +1 -6
  34. data/app/models/pageflow/published_entry.rb +1 -0
  35. data/app/models/pageflow/revision.rb +3 -0
  36. data/app/models/pageflow/storyline.rb +0 -2
  37. data/app/views/admin/entries/_links.html.arb +1 -1
  38. data/app/views/admin/features/_form.html.erb +1 -1
  39. data/app/views/components/pageflow/admin/add_membership_button.rb +13 -1
  40. data/app/views/layouts/pageflow/application.html.erb +3 -19
  41. data/app/views/layouts/pageflow/editor.html.erb +18 -0
  42. data/app/views/pageflow/admin/accounts/_cannot_add_account.html.erb +0 -0
  43. data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +5 -0
  44. data/app/views/pageflow/admin/users/_cannot_add.html.erb +8 -0
  45. data/app/views/pageflow/admin/users/_cannot_add_account.html.erb +0 -0
  46. data/app/views/pageflow/admin/users/_cannot_add_entry.html +0 -0
  47. data/app/views/pageflow/{config/_editor_seeds.json.jbuilder → editor/config/_seeds.json.jbuilder} +3 -2
  48. data/app/views/pageflow/editor/entries/seed.json.erb +5 -4
  49. data/app/views/pageflow/{entries/edit.html.erb → editor/entries/show.html.erb} +5 -9
  50. data/app/views/pageflow/{entries → editor/entries}/show.json.jbuilder +0 -0
  51. data/app/views/pageflow/entries/{show.css.erb → stylesheet.css.erb} +0 -0
  52. data/app/views/pageflow/entry_json_seed/_entry.json.jbuilder +2 -8
  53. data/config/initializers/entry_types.rb +4 -0
  54. data/config/initializers/features.rb +0 -10
  55. data/config/initializers/help_entries.rb +0 -8
  56. data/config/locales/de.yml +4 -0
  57. data/config/locales/en.yml +4 -0
  58. data/config/routes.rb +10 -5
  59. data/db/migrate/20191202145757_create_pageflow_scrolled_sections.rb +21 -0
  60. data/db/migrate/20191202150657_create_pageflow_scrolled_chapters.rb +11 -0
  61. data/db/migrate/20191202154723_create_pageflow_scrolled_content_elements.rb +21 -0
  62. data/db/migrate/20191219143450_add_position_to_content_elements.rb +5 -0
  63. data/db/migrate/20191220100946_create_pageflow_scrolled_storylines.rb +24 -0
  64. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +9805 -114
  65. data/entry_types/paged/app/assets/javascripts/pageflow_paged/editor.js +7 -0
  66. data/entry_types/paged/app/assets/stylesheets/pageflow_paged/editor.scss +1 -0
  67. data/entry_types/paged/app/controllers/concerns/pageflow_paged/without_controller_namespace_partial_path_prefix.rb +21 -0
  68. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +25 -0
  69. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +17 -0
  70. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +25 -0
  71. data/{app/views/layouts/pageflow → entry_types/paged/app/views/layouts/pageflow_paged}/_ie_include_tags.html.erb +0 -0
  72. data/{app/views/layouts/pageflow → entry_types/paged/app/views/layouts/pageflow_paged}/_loading_spinner_inline_script.html.erb +0 -0
  73. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +33 -0
  74. data/entry_types/paged/app/views/pageflow_paged/chapters/_chapter.html.erb +7 -0
  75. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_body.html.erb +4 -0
  76. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +12 -0
  77. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_indicators_seed.html.erb +3 -0
  78. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_seed.json.jbuilder +0 -0
  79. data/entry_types/paged/app/views/pageflow_paged/editor/entries/partials.html.erb +3 -0
  80. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_entry.html.erb +7 -5
  81. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_header.html.erb +0 -0
  82. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_ie8_hint.html.erb +0 -0
  83. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_indicators.html.erb +0 -0
  84. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_multimedia_alert.html.erb +0 -0
  85. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_non_js_hint.html.erb +0 -0
  86. data/entry_types/paged/app/views/pageflow_paged/entries/_overview.html.erb +1 -0
  87. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_skip_links.html.erb +0 -0
  88. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_chapter.html.erb +3 -1
  89. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_entry.html.erb +1 -1
  90. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_page.html.erb +0 -0
  91. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/show.html.erb +3 -3
  92. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/pages/_page.html.erb +1 -1
  93. data/entry_types/paged/config/initializers/features.rb +16 -0
  94. data/entry_types/paged/config/initializers/page_types.rb +16 -0
  95. data/entry_types/paged/config/routes.rb +3 -0
  96. data/entry_types/paged/lib/pageflow_paged.rb +19 -0
  97. data/entry_types/paged/lib/pageflow_paged/configuration.rb +16 -0
  98. data/entry_types/paged/lib/pageflow_paged/engine.rb +7 -0
  99. data/entry_types/paged/lib/pageflow_paged/plugin.rb +8 -0
  100. data/entry_types/scrolled/app/assets/stylesheets/pageflow_scrolled/editor.scss +1 -0
  101. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +56 -0
  102. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +61 -0
  103. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/entries_controller.rb +8 -0
  104. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +59 -0
  105. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
  106. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +21 -0
  107. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +33 -0
  108. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +40 -0
  109. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +17 -0
  110. data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +26 -0
  111. data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +39 -0
  112. data/entry_types/scrolled/app/views/pageflow_scrolled/chapters/_chapter.json.jbuilder +8 -0
  113. data/entry_types/scrolled/app/views/pageflow_scrolled/content_elements/_content_element.json.jbuilder +9 -0
  114. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_body.html.erb +1 -0
  115. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +12 -0
  116. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -0
  117. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +22 -0
  118. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +35 -0
  119. data/entry_types/scrolled/app/views/pageflow_scrolled/sections/_section.json.jbuilder +8 -0
  120. data/entry_types/scrolled/config/routes.rb +23 -0
  121. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +34 -0
  122. data/entry_types/scrolled/lib/pageflow_scrolled.rb +19 -0
  123. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +6 -0
  124. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +16 -0
  125. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +133 -0
  126. data/entry_types/scrolled/spec/factories/chapters.rb +12 -0
  127. data/entry_types/scrolled/spec/factories/content_elements.rb +36 -0
  128. data/entry_types/scrolled/spec/factories/sections.rb +26 -0
  129. data/entry_types/scrolled/spec/factories/storylines.rb +12 -0
  130. data/entry_types/scrolled/spec/fixtures/image.jpg +0 -0
  131. data/lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb +1 -1
  132. data/lib/generators/pageflow/assets/assets_generator.rb +2 -2
  133. data/lib/pageflow/built_in_page_types_plugin.rb +5 -3
  134. data/lib/pageflow/built_in_widget_types_plugin.rb +38 -12
  135. data/lib/pageflow/configuration.rb +76 -15
  136. data/lib/pageflow/editor_controller.rb +44 -0
  137. data/lib/pageflow/engine.rb +2 -3
  138. data/lib/pageflow/entries_controller_env_helper.rb +44 -0
  139. data/lib/pageflow/entry_type.rb +19 -2
  140. data/lib/pageflow/entry_type_configuration.rb +44 -0
  141. data/lib/pageflow/entry_types.rb +22 -0
  142. data/lib/pageflow/feature.rb +11 -5
  143. data/lib/pageflow/file_importers.rb +2 -2
  144. data/lib/pageflow/file_type.rb +3 -2
  145. data/lib/pageflow/file_types.rb +23 -3
  146. data/lib/pageflow/global_config_api.rb +11 -4
  147. data/lib/pageflow/page_types.rb +30 -0
  148. data/lib/pageflow/partial_editor_fragment_renderer.rb +37 -0
  149. data/lib/pageflow/revision_component.rb +2 -5
  150. data/lib/pageflow/revision_components.rb +18 -0
  151. data/lib/pageflow/version.rb +1 -1
  152. data/lib/pageflow/widget_type.rb +3 -0
  153. data/lib/pageflow/widget_types.rb +1 -1
  154. data/spec/factories/draft_entries.rb +11 -0
  155. data/spec/factories/published_entries.rb +17 -0
  156. data/vendor/assets/javascripts/dash.all.min.js +0 -1
  157. metadata +146 -29
  158. data/app/views/pageflow/chapters/_chapter.html.erb +0 -5
  159. data/app/views/pageflow/editor/entries/_indicators_seed.html.erb +0 -3
  160. data/app/views/pageflow/entries/_overview.html.erb +0 -1
  161. data/app/views/pageflow/entries/partials.html.erb +0 -3
  162. data/config/initializers/page_type_helpers.rb +0 -8
@@ -0,0 +1,8 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # @api private
4
+ class EntriesController < ActionController::Base
5
+ helper SeedHtmlHelper
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,59 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # @api private
4
+ class SectionsController < ActionController::Base
5
+ include Pageflow::EditorController
6
+
7
+ def create
8
+ chapter = Chapter.all_for_revision(@entry.draft).find(params[:chapter_id])
9
+ section = chapter.sections.create(section_params)
10
+
11
+ render partial: 'pageflow_scrolled/sections/section',
12
+ locals: {section: section},
13
+ status: :created
14
+ end
15
+
16
+ def update
17
+ section = Section.all_for_revision(@entry.draft).find(params[:id])
18
+ section.update_attributes(section_params)
19
+
20
+ render partial: 'pageflow_scrolled/sections/section', locals: {section: section}
21
+ rescue ActiveRecord::RecordNotFound
22
+ head :not_found
23
+ end
24
+
25
+ def destroy
26
+ section = Section.all_for_revision(@entry.draft).find(params[:id])
27
+ section.destroy
28
+
29
+ render partial: 'pageflow_scrolled/sections/section', locals: {section: section}
30
+ rescue ActiveRecord::RecordNotFound
31
+ head :not_found
32
+ end
33
+
34
+ def order
35
+ chapter = Chapter.all_for_revision(@entry.draft).find(params[:chapter_id])
36
+ storyline = chapter.storyline
37
+
38
+ params.require(:ids).each_with_index do |id, index|
39
+ storyline.sections.update(id,
40
+ chapter_id: chapter.id,
41
+ position: index)
42
+ end
43
+
44
+ head :no_content
45
+ rescue ActiveRecord::RecordNotFound
46
+ head :not_found
47
+ end
48
+
49
+ private
50
+
51
+ def section_params
52
+ configuration = params.require(:section)[:configuration].try(:permit!) || {}
53
+ params.require(:section)
54
+ .permit(:position)
55
+ .merge(configuration: configuration)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,10 @@
1
+ module PageflowScrolled
2
+ # @api private
3
+ class EntriesController < ActionController::Base
4
+ include Pageflow::EntriesControllerEnvHelper
5
+
6
+ def show
7
+ @entry = get_published_entry_from_env
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # @api private
4
+ module SeedHtmlHelper
5
+ include EntryJsonSeedHelper
6
+
7
+ def scrolled_editor_iframe_seed_html_script_tag(entry)
8
+ html = render(template: 'pageflow_scrolled/entries/show',
9
+ locals: {
10
+ :@entry => entry,
11
+ :@seed_options => {skip_collections: true}
12
+ })
13
+
14
+ content_tag(:script,
15
+ html.gsub('</', '<\/').html_safe,
16
+ type: 'text/html',
17
+ data: {template: 'iframe_seed'})
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ module PageflowScrolled
2
+ # Render seed data for published scrolled entries.
3
+ #
4
+ # @api private
5
+ module EntryJsonSeedHelper
6
+ include Pageflow::ConfigHelper
7
+ include Pageflow::RenderJsonHelper
8
+ include Pageflow::FilesHelper
9
+
10
+ def scrolled_entry_json_seed_script_tag(scrolled_entry, options = {})
11
+ seed_json = render_json do |json|
12
+ scrolled_entry_json_seed(json, scrolled_entry, options)
13
+ end
14
+
15
+ content_tag(:script, <<-JS.html_safe)
16
+ var pageflowScrolledSeed = #{sanitize_json(seed_json)};
17
+ JS
18
+ end
19
+
20
+ def scrolled_entry_json_seed(json, scrolled_entry, options = {})
21
+ main_storyline = Storyline.all_for_revision(scrolled_entry.revision).first
22
+ main_storyline ||= Storyline.new
23
+
24
+ json.partial!('pageflow_scrolled/entry_json_seed/entry',
25
+ chapters: main_storyline.chapters,
26
+ entry: scrolled_entry,
27
+ entry_config: Pageflow.config_for(scrolled_entry),
28
+ sections: main_storyline.sections,
29
+ content_elements: main_storyline.content_elements,
30
+ options: options)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,40 @@
1
+ module PageflowScrolled
2
+ class Chapter < Pageflow::ApplicationRecord
3
+ include Pageflow::SerializedConfiguration
4
+ include Pageflow::AutoGeneratedPermaId
5
+
6
+ belongs_to :storyline, touch: true
7
+ has_many :sections,
8
+ -> { order('pageflow_scrolled_sections.position ASC') },
9
+ dependent: :destroy,
10
+ inverse_of: :chapter
11
+ has_many :content_elements, through: :sections
12
+
13
+ attr_accessor :revision # used on :create to lazily create storyline
14
+ before_validation :ensure_storyline, on: :create
15
+
16
+ def self.all_for_revision(revision)
17
+ joins(storyline: :revision)
18
+ .where(pageflow_scrolled_storylines: {revision_id: revision})
19
+ end
20
+
21
+ def copy_to(storyline)
22
+ chapter = dup
23
+ storyline.chapters << chapter
24
+
25
+ sections.each do |section|
26
+ section.copy_to(chapter)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def ensure_storyline
33
+ return if storyline.present?
34
+ unless Storyline.all_for_revision(revision).exists?
35
+ Storyline.create!(revision: revision, configuration: {main: true})
36
+ end
37
+ self.storyline = Storyline.all_for_revision(revision).first
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,17 @@
1
+ module PageflowScrolled
2
+ class ContentElement < Pageflow::ApplicationRecord
3
+ include Pageflow::SerializedConfiguration
4
+ include Pageflow::AutoGeneratedPermaId
5
+
6
+ belongs_to :section
7
+
8
+ def self.all_for_revision(revision)
9
+ joins(section: {chapter: {storyline: :revision}})
10
+ .where(pageflow_scrolled_storylines: {revision_id: revision})
11
+ end
12
+
13
+ def copy_to(section)
14
+ section.content_elements << dup
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ module PageflowScrolled
2
+ class Section < Pageflow::ApplicationRecord
3
+ include Pageflow::SerializedConfiguration
4
+ include Pageflow::AutoGeneratedPermaId
5
+
6
+ belongs_to :chapter
7
+ has_many :content_elements,
8
+ -> { order('pageflow_scrolled_content_elements.position ASC') },
9
+ dependent: :destroy,
10
+ inverse_of: :section
11
+
12
+ def self.all_for_revision(revision)
13
+ joins(chapter: {storyline: :revision})
14
+ .where(pageflow_scrolled_storylines: {revision_id: revision})
15
+ end
16
+
17
+ def copy_to(chapter)
18
+ section = dup
19
+ chapter.sections << section
20
+
21
+ content_elements.each do |content_element|
22
+ content_element.copy_to(section)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,39 @@
1
+ module PageflowScrolled
2
+ class Storyline < Pageflow::ApplicationRecord
3
+ SECTIONS_ORDER = [
4
+ 'pageflow_scrolled_chapters.position ASC',
5
+ 'pageflow_scrolled_sections.position ASC'
6
+ ].join(',')
7
+
8
+ CONTENT_ELEMENTS_ORDER = [
9
+ 'pageflow_scrolled_chapters.position ASC',
10
+ 'pageflow_scrolled_sections.position ASC',
11
+ 'pageflow_scrolled_content_elements.position ASC'
12
+ ].join(',')
13
+
14
+ include Pageflow::RevisionComponent
15
+ include Pageflow::SerializedConfiguration
16
+
17
+ has_many :chapters,
18
+ -> { order('pageflow_scrolled_chapters.position ASC') },
19
+ class_name: 'PageflowScrolled::Chapter',
20
+ dependent: :destroy,
21
+ inverse_of: :storyline
22
+ has_many :sections,
23
+ -> { reorder(SECTIONS_ORDER) },
24
+ through: :chapters
25
+ has_many :content_elements,
26
+ -> { reorder(CONTENT_ELEMENTS_ORDER) },
27
+ through: :sections
28
+
29
+ def copy_to(revision)
30
+ storyline = dup
31
+ storyline.revision = revision
32
+ storyline.save!
33
+
34
+ chapters.each do |chapter|
35
+ chapter.copy_to(storyline)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ json.key_format!(camelize: :lower)
2
+
3
+ json.call(chapter,
4
+ :id,
5
+ :perma_id,
6
+ :storyline_id,
7
+ :position,
8
+ :configuration)
@@ -0,0 +1,9 @@
1
+ json.key_format!(camelize: :lower)
2
+
3
+ json.call(content_element,
4
+ :id,
5
+ :perma_id,
6
+ :type_name,
7
+ :position,
8
+ :section_id,
9
+ :configuration)
@@ -0,0 +1 @@
1
+ <%= scrolled_editor_iframe_seed_html_script_tag(entry) %>
@@ -0,0 +1,12 @@
1
+ <%= stylesheet_link_tag 'pageflow_paged/editor', media: 'all' %>
2
+
3
+ <%= javascript_include_tag 'pageflow/vendor' %>
4
+
5
+ <%# Can be removed once remaining mentions of pageflow global in editor are removed %>
6
+ <script>
7
+ window.PAGEFLOW_EDITOR = true;
8
+ </script>
9
+ <%= javascript_include_tag 'pageflow/application' %>
10
+
11
+ <%= javascript_include_tag 'pageflow/editor/vendor' %>
12
+ <%= javascript_pack_tag 'pageflow-scrolled-editor' %>
@@ -0,0 +1 @@
1
+ scrolled_entry_json_seed(json, entry, skip_files: true)
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <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">
6
+ <meta name="theme-color" content="#000000" />
7
+ <meta
8
+ name="description"
9
+ content="Pageflow Next Showcase"
10
+ />
11
+ <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700&display=swap" rel="stylesheet">
12
+ <title>Pageflow Next Showcase</title>
13
+ </head>
14
+ <body>
15
+ <noscript>You need to enable JavaScript to run this app.</noscript>
16
+ <div id="root"></div>
17
+
18
+ <%= scrolled_entry_json_seed_script_tag(@entry, @seed_options || {}) %>
19
+
20
+ <%= javascript_pack_tag 'pageflow-scrolled-frontend' %>
21
+ </body>
22
+ </html>
@@ -0,0 +1,35 @@
1
+ json.key_format!(camelize: :lower)
2
+
3
+ json.config do
4
+ json.file_url_templates do
5
+ config_file_url_templates_seed(json, entry_config)
6
+ end
7
+ json.file_model_types do
8
+ config_file_model_types_seed(json, entry_config)
9
+ end
10
+ end
11
+
12
+ unless options[:skip_collections]
13
+ json.collections do
14
+ json.chapters do
15
+ json.array!(chapters) do |chapter|
16
+ json.partial! 'pageflow_scrolled/chapters/chapter', chapter: chapter
17
+ end
18
+ end
19
+
20
+ json.sections do
21
+ json.array!(sections) do |section|
22
+ json.partial! 'pageflow_scrolled/sections/section', section: section
23
+ end
24
+ end
25
+
26
+ json.content_elements do
27
+ json.array!(content_elements) do |content_element|
28
+ json.partial! 'pageflow_scrolled/content_elements/content_element',
29
+ content_element: content_element
30
+ end
31
+ end
32
+
33
+ files_json_seed(json, entry) unless options[:skip_files]
34
+ end
35
+ end
@@ -0,0 +1,8 @@
1
+ json.key_format!(camelize: :lower)
2
+
3
+ json.call(section,
4
+ :id,
5
+ :perma_id,
6
+ :chapter_id,
7
+ :position,
8
+ :configuration)
@@ -0,0 +1,23 @@
1
+ PageflowScrolled::Engine.routes.draw do
2
+ scope module: 'editor' do
3
+ shallow do
4
+ resources :chapters do
5
+ collection do
6
+ put :order
7
+ end
8
+
9
+ resources :sections do
10
+ collection do
11
+ put :order
12
+ end
13
+
14
+ resources :content_elements do
15
+ collection do
16
+ put :order
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ module PageflowScrolled
2
+ module Generators
3
+ # @api private
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Installs Pageflow Scrolled entry type.'
6
+
7
+ def install_webpacker
8
+ require 'webpacker'
9
+ gemfile = File.expand_path('../../../../../../Gemfile', __dir__)
10
+ rake "webpacker:install BUNDLE_GEMFILE=#{gemfile}"
11
+ end
12
+
13
+ def webpack_environment
14
+ inject_into_file('config/webpack/environment.js',
15
+ before: "module.exports = environment\n") do
16
+ "const pageflowConfig = require('pageflow/config/webpack')\n" \
17
+ "environment.config.merge(pageflowConfig)\n\n"
18
+ end
19
+ end
20
+
21
+ def editor_pack
22
+ create_file 'app/javascript/packs/pageflow-scrolled-editor.js', <<-JS
23
+ import 'pageflow-scrolled/editor';
24
+ JS
25
+ end
26
+
27
+ def frontend_pack
28
+ create_file 'app/javascript/packs/pageflow-scrolled-frontend.js', <<-JS
29
+ import 'pageflow-scrolled/frontend';
30
+ JS
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,4 +2,23 @@ require 'pageflow_scrolled/engine'
2
2
 
3
3
  # Entry type plugin for entries using native scrolling
4
4
  module PageflowScrolled
5
+ class << self
6
+ def plugin
7
+ PageflowScrolled::Plugin.new
8
+ end
9
+
10
+ def entry_type
11
+ Pageflow::EntryType.new(name: 'scrolled',
12
+ frontend_app: PageflowScrolled::EntriesController.action(:show),
13
+ configuration: PageflowScrolled::Configuration,
14
+ editor_fragment_renderer: editor_fragment_renderer,
15
+ editor_app: PageflowScrolled::Engine)
16
+ end
17
+
18
+ private
19
+
20
+ def editor_fragment_renderer
21
+ Pageflow::PartialEditorFragmentRenderer.new(PageflowScrolled::Editor::EntriesController)
22
+ end
23
+ end
5
24
  end