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,7 @@
1
+ //= require pageflow/editor/vendor
2
+ //= require ./dist/editor
3
+ //= require_self
4
+
5
+ //= require pageflow/editor
6
+
7
+ _.extend(pageflow, pageflow_paged);
@@ -0,0 +1 @@
1
+ @import "pageflow/editor";
@@ -0,0 +1,21 @@
1
+ module PageflowPaged
2
+ # @api private
3
+ module WithoutControllerNamespacePartialPathPrefix
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ around_action :without_controller_namespace_partial_path_prefix
8
+ end
9
+
10
+ private
11
+
12
+ def without_controller_namespace_partial_path_prefix
13
+ old_value = ActionView::Base.prefix_partial_path_with_controller_namespace
14
+ ActionView::Base.prefix_partial_path_with_controller_namespace = false
15
+
16
+ yield
17
+ ensure
18
+ ActionView::Base.prefix_partial_path_with_controller_namespace = old_value
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ module PageflowPaged
2
+ # @api private
3
+ class ApplicationController < ActionController::Base
4
+ layout 'pageflow_paged/application'
5
+
6
+ helper Pageflow::AudioFilesHelper
7
+ helper Pageflow::BackgroundImageHelper
8
+ helper Pageflow::EntriesHelper
9
+ helper Pageflow::FileBackgroundImagesHelper
10
+ helper Pageflow::FileThumbnailsHelper
11
+ helper Pageflow::InfoBoxHelper
12
+ helper Pageflow::NavigationBarHelper
13
+ helper Pageflow::OverviewHelper
14
+ helper Pageflow::PageBackgroundAssetHelper
15
+ helper Pageflow::PagesHelper
16
+ helper Pageflow::PageTypesHelper
17
+ helper Pageflow::ReactServerSideRenderingHelper
18
+ helper Pageflow::RevisionFileHelper
19
+ helper Pageflow::SocialShareHelper
20
+ helper Pageflow::SocialShareLinksHelper
21
+ helper Pageflow::TextDirectionHelper
22
+ helper Pageflow::VideoFilesHelper
23
+ helper Pageflow::WidgetsHelper
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ module PageflowPaged
2
+ module Editor
3
+ # @api private
4
+ class EntriesController < PageflowPaged::ApplicationController
5
+ include Pageflow::EditorController
6
+
7
+ skip_before_action :verify_edit_lock, only: :partials
8
+
9
+ helper_method :render_to_string
10
+
11
+ def partials
12
+ I18n.locale = @entry.locale
13
+ render action: 'partials', layout: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ module PageflowPaged
2
+ # @api private
3
+ class EntriesController < PageflowPaged::ApplicationController
4
+ include Pageflow::EntriesControllerEnvHelper
5
+ include WithoutControllerNamespacePartialPathPrefix
6
+
7
+ helper Pageflow::MetaTagsHelper
8
+ helper Pageflow::StructuredDataHelper
9
+ helper Pageflow::PublicI18nHelper
10
+
11
+ def show
12
+ @entry = get_published_entry_from_env
13
+ @widget_scope = get_entry_mode_from_env
14
+
15
+ I18n.locale = @entry.locale
16
+
17
+ @entry.share_target =
18
+ if params[:page].present?
19
+ @entry.pages.find_by_perma_id(params[:page])
20
+ else
21
+ @entry
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <%= content_tag(:html, lang: I18n.locale, dir: @page_text_direction) do %>
3
+ <head>
4
+ <title><%= @page_title.presence || 'Pageflow' %></title>
5
+
6
+ <script>
7
+ window.PAGEFLOW_EDITOR = false;
8
+ </script>
9
+
10
+ <%= javascript_include_tag 'pageflow/vendor', 'data-turbolinks-track' => true %>
11
+ <%= javascript_include_tag 'pageflow/application', 'data-turbolinks-track' => true %>
12
+
13
+ <%= csrf_meta_tags %>
14
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1" />
15
+ <meta name="apple-mobile-web-app-capable" content="yes" />
16
+
17
+ <%= yield :head %>
18
+
19
+ <%= stylesheet_link_tag 'pageflow/print_view', media: 'print', 'data-turbolinks-track' => true %>
20
+ <%= render 'layouts/pageflow_paged/loading_spinner_inline_script' %>
21
+
22
+ <%= render 'layouts/pageflow_paged/ie_include_tags' %>
23
+ </head>
24
+
25
+ <body class="load_all_images has_no_mobile_platform non_js">
26
+ <script>
27
+ jQuery('body').removeClass('load_all_images');
28
+ jQuery("body").removeClass('non_js').addClass('js');
29
+ </script>
30
+ <%= yield %>
31
+ <%= render 'layouts/pageflow/theme_probes' %>
32
+ </body>
33
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <section class="chapter">
2
+ <h2><%= chapter.title %></h2>
3
+
4
+ <%= render(partial: 'pageflow_paged/pages/page',
5
+ collection: chapter.pages,
6
+ locals: {entry: entry}) %>
7
+ </section>
@@ -0,0 +1,4 @@
1
+ <% I18n.with_locale(entry.locale) do %>
2
+ <%= page_type_templates(entry) %>
3
+ <%= render('pageflow_paged/editor/entries/indicators_seed', theme: entry.theme) %>
4
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= stylesheet_link_tag 'pageflow/application_with_simulated_media_queries', media: 'all' %>
2
+ <%= stylesheet_link_tag 'pageflow_paged/editor', media: 'all' %>
3
+
4
+ <script>
5
+ window.PAGEFLOW_EDITOR = true;
6
+ </script>
7
+
8
+ <%= javascript_include_tag 'pageflow/vendor' %>
9
+ <%= javascript_include_tag 'pageflow/application' %>
10
+ <%= javascript_include_tag 'pageflow_paged/editor' %>
11
+
12
+ <%= render 'layouts/pageflow_paged/ie_include_tags' %>
@@ -0,0 +1,3 @@
1
+ <div id="indicators_seed">
2
+ <%= render('pageflow_paged/entries/indicators', theme: theme) %>
3
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= render 'pageflow_paged/entries/header', entry: @entry %>
2
+ <%= render 'pageflow_paged/entries/overview', entry: @entry %>
3
+ <%= render_widgets(@entry, scope: :editor) %>
@@ -4,7 +4,7 @@
4
4
  class: entry_css_class(entry)) do %>
5
5
  <%= structured_data_for_entry(entry) %>
6
6
 
7
- <%= render 'pageflow/entries/skip_links' %>
7
+ <%= render 'pageflow_paged/entries/skip_links' %>
8
8
 
9
9
  <h1 class="hidden"><%= entry.title %></h1>
10
10
 
@@ -12,11 +12,13 @@
12
12
  <span class="print_only page_url"><%= request.original_url %></span>
13
13
 
14
14
  <%= content_tag :div, :id => 'content', :class => 'entry', :data => {:role => 'slideshow'} do %>
15
- <%= render entry.chapters, entry: entry %>
16
- <%= render 'pageflow/entries/indicators', :theme => entry.theme %>
15
+ <%= render(partial: 'pageflow_paged/chapters/chapter',
16
+ collection: entry.chapters,
17
+ locals: {entry: entry}) %>
18
+ <%= render 'pageflow_paged/entries/indicators', theme: entry.theme %>
17
19
  <% end %>
18
20
 
19
- <%= render 'pageflow/entries/header', :entry => entry %>
20
- <%= render 'pageflow/entries/overview', :entry => entry %>
21
+ <%= render 'pageflow_paged/entries/header', entry: entry %>
22
+ <%= render 'pageflow_paged/entries/overview', entry: entry %>
21
23
  <%= render_widgets(entry, scope: widget_scope, insert_point: :bottom_of_entry) %>
22
24
  <% end %>
@@ -0,0 +1 @@
1
+ <%= render('pageflow_paged/entries/overview/entry', entry: entry) %>
@@ -5,7 +5,9 @@
5
5
  <span class="heading-5"><%= "#{t('pageflow.public.chapter')} #{chapter.position + 1}" if index == 0 %></span>
6
6
  <% end %>
7
7
  <span class="heading-4"><%= chapter.title if index == 0 %></span>
8
- <%= render :partial => 'pageflow/entries/overview/page', :collection => page_group, :locals => {:chapter => chapter} %>
8
+ <%= render(partial: 'pageflow_paged/entries/overview/page',
9
+ collection: page_group,
10
+ locals: {chapter: chapter}) %>
9
11
  </div>
10
12
 
11
13
  <% end %>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <div class="wrapper">
15
15
  <div class="scroller">
16
- <%= render(partial: 'pageflow/entries/overview/chapter',
16
+ <%= render(partial: 'pageflow_paged/entries/overview/chapter',
17
17
  collection: entry.main_storyline_chapters,
18
18
  locals: {chapters_count: entry.main_storyline_chapters.count}) %>
19
19
  </div>
@@ -17,10 +17,10 @@
17
17
 
18
18
  <%= cache [@entry, :body, @widget_scope] do %>
19
19
 
20
- <%= render 'pageflow/entries/ie8_hint' %>
21
- <%= render 'pageflow/entries/multimedia_alert' %>
20
+ <%= render 'pageflow_paged/entries/ie8_hint' %>
21
+ <%= render 'pageflow_paged/entries/multimedia_alert' %>
22
22
  <%= render_widgets(@entry, scope: @widget_scope, insert_point: :before_entry) %>
23
- <%= render @entry, :widget_scope => @widget_scope %>
23
+ <%= render 'pageflow_paged/entries/entry', entry: @entry, widget_scope: @widget_scope %>
24
24
 
25
25
  <script>
26
26
  pageflow.seed = <%= entry_json_seed(@entry) %>;
@@ -1,4 +1,4 @@
1
- <%= cache page do %>
1
+ <%= cache [entry.locale, page] do %>
2
2
  <%= content_tag(:section,
3
3
  id: page.perma_id,
4
4
  class: page_css_class(page),
@@ -0,0 +1,16 @@
1
+ Pageflow.configure do |config|
2
+ config.for_entry_type(PageflowPaged.entry_type) do |entry_type_config|
3
+ entry_type_config.features.register('auto_change_page')
4
+ entry_type_config.features.register('delayed_text_fade_in')
5
+
6
+ entry_type_config.features.register('storylines') do |feature_config|
7
+ feature_config.help_entries.register('pageflow.help_entries.storylines', priority: 7)
8
+ end
9
+
10
+ entry_type_config.features.register('editor_emulation_mode')
11
+ entry_type_config.features.register('waveform_player_controls')
12
+ entry_type_config.features.register('structured_data')
13
+
14
+ entry_type_config.features.enable_by_default('structured_data')
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ Pageflow.after_global_configure do |config|
2
+ config.for_entry_type(PageflowPaged.entry_type) do |entry_type_config|
3
+ entry_type_config.page_types.each do |page_type|
4
+ page_type.view_helpers.each do |helper|
5
+ PageflowPaged::EntriesController.helper(helper)
6
+ PageflowPaged::Editor::EntriesController.helper(helper)
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ Pageflow.after_configure do |config|
13
+ config.for_entry_type(PageflowPaged.entry_type) do |entry_type_config|
14
+ entry_type_config.page_types.setup(entry_type_config)
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ PageflowPaged::Engine.routes.draw do
2
+ get '/partials' => 'editor/entries#partials'
3
+ end
@@ -2,4 +2,23 @@ require 'pageflow_paged/engine'
2
2
 
3
3
  # Entry type plugin for classic Pageflow entries
4
4
  module PageflowPaged
5
+ class << self
6
+ def plugin
7
+ PageflowPaged::Plugin.new
8
+ end
9
+
10
+ def entry_type
11
+ Pageflow::EntryType.new(name: 'paged',
12
+ frontend_app: PageflowPaged::EntriesController.action(:show),
13
+ configuration: PageflowPaged::Configuration,
14
+ editor_app: PageflowPaged::Engine,
15
+ editor_fragment_renderer: editor_fragment_renderer)
16
+ end
17
+
18
+ private
19
+
20
+ def editor_fragment_renderer
21
+ Pageflow::PartialEditorFragmentRenderer.new(PageflowPaged::Editor::EntriesController)
22
+ end
23
+ end
5
24
  end
@@ -0,0 +1,16 @@
1
+ module PageflowPaged
2
+ # Configuration options for paged entry type
3
+ class Configuration
4
+ include Pageflow::EntryTypeConfiguration
5
+
6
+ # Register new types of pages.
7
+ # @return {Pageflow::PageTypes}
8
+ attr_reader :page_types
9
+
10
+ # @api private
11
+ def initialize(*)
12
+ super
13
+ @page_types = Pageflow::PageTypes.new
14
+ end
15
+ end
16
+ end
@@ -4,5 +4,12 @@ module PageflowPaged
4
4
  isolate_namespace PageflowPaged
5
5
 
6
6
  config.paths.add('lib', eager_load: true)
7
+
8
+ initializer 'pageflow_paged.assets.precompile' do |app|
9
+ app.config.assets.precompile += %w[
10
+ pageflow_paged/editor.js
11
+ pageflow_paged/editor.css
12
+ ]
13
+ end
7
14
  end
8
15
  end
@@ -0,0 +1,8 @@
1
+ module PageflowPaged
2
+ # @api private
3
+ class Plugin < Pageflow::Plugin
4
+ def configure(config)
5
+ config.entry_types.register(PageflowPaged.entry_type)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,56 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # @api private
4
+ class ChaptersController < ActionController::Base
5
+ include Pageflow::EditorController
6
+
7
+ def create
8
+ chapter = Chapter.create(chapter_params.merge(revision: @entry.draft))
9
+
10
+ render partial: 'pageflow_scrolled/chapters/chapter',
11
+ locals: {chapter: chapter},
12
+ status: :created
13
+ end
14
+
15
+ def update
16
+ chapter = Chapter.all_for_revision(@entry.draft).find(params[:id])
17
+ chapter.update_attributes(chapter_params)
18
+
19
+ render partial: 'pageflow_scrolled/chapters/chapter', locals: {chapter: chapter}
20
+ rescue ActiveRecord::RecordNotFound
21
+ head :not_found
22
+ end
23
+
24
+ def destroy
25
+ chapter = Chapter.all_for_revision(@entry.draft).find(params[:id])
26
+ chapter.destroy
27
+
28
+ render partial: 'pageflow_scrolled/chapters/chapter', locals: {chapter: chapter}
29
+ rescue ActiveRecord::RecordNotFound
30
+ head :not_found
31
+ end
32
+
33
+ def order
34
+ storyline = Storyline.all_for_revision(@entry.draft).find(params[:storyline_id])
35
+ chapters = Chapter.all_for_revision(@entry.draft)
36
+
37
+ params.require(:ids).each_with_index do |id, index|
38
+ chapters.update(id, storyline_id: storyline.id, position: index)
39
+ end
40
+
41
+ head :no_content
42
+ rescue ActiveRecord::RecordNotFound
43
+ head :not_found
44
+ end
45
+
46
+ private
47
+
48
+ def chapter_params
49
+ configuration = params.require(:chapter)[:configuration].try(:permit!) || {}
50
+ params.require(:chapter)
51
+ .permit(:position)
52
+ .merge(configuration: configuration)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,61 @@
1
+ module PageflowScrolled
2
+ module Editor
3
+ # @api private
4
+ class ContentElementsController < ActionController::Base
5
+ include Pageflow::EditorController
6
+
7
+ def create
8
+ section = Section.all_for_revision(@entry.draft).find(params[:section_id])
9
+ content_element = section.content_elements.create(content_element_params)
10
+
11
+ render partial: 'pageflow_scrolled/content_elements/content_element',
12
+ locals: {content_element: content_element},
13
+ status: :created
14
+ end
15
+
16
+ def update
17
+ content_element = ContentElement.all_for_revision(@entry.draft).find(params[:id])
18
+ content_element.update_attributes(content_element_params)
19
+
20
+ render partial: 'pageflow_scrolled/content_elements/content_element',
21
+ locals: {content_element: content_element}
22
+ rescue ActiveRecord::RecordNotFound
23
+ head :not_found
24
+ end
25
+
26
+ def destroy
27
+ content_element = ContentElement.all_for_revision(@entry.draft).find(params[:id])
28
+ content_element.destroy
29
+
30
+ render partial: 'pageflow_scrolled/content_elements/content_element',
31
+ locals: {content_element: content_element}
32
+ rescue ActiveRecord::RecordNotFound
33
+ head :not_found
34
+ end
35
+
36
+ def order
37
+ section = Section.all_for_revision(@entry.draft).find(params[:section_id])
38
+ storyline = section.chapter.storyline
39
+
40
+ params.require(:ids).each_with_index do |id, index|
41
+ storyline.content_elements.update(id,
42
+ section_id: section.id,
43
+ position: index)
44
+ end
45
+
46
+ head :no_content
47
+ rescue ActiveRecord::RecordNotFound
48
+ head :not_found
49
+ end
50
+
51
+ private
52
+
53
+ def content_element_params
54
+ configuration = params.require(:content_element)[:configuration].try(:permit!) || {}
55
+ params.require(:content_element)
56
+ .permit(:type_name, :position)
57
+ .merge(configuration: configuration)
58
+ end
59
+ end
60
+ end
61
+ end