pageflow 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (263) hide show
  1. checksums.yaml +5 -13
  2. data/CHANGELOG.md +193 -11
  3. data/README.md +9 -1
  4. data/Rakefile +5 -0
  5. data/admins/pageflow/accounts.rb +2 -1
  6. data/admins/pageflow/entry.rb +21 -1
  7. data/admins/pageflow/revisions.rb +1 -1
  8. data/app/assets/fonts/pageflow/entypo-license.txt +358 -0
  9. data/app/assets/fonts/pageflow/fontawesome-license.txt +1 -0
  10. data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.eot +0 -0
  11. data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.svg +1236 -194
  12. data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.ttf +0 -0
  13. data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.woff +0 -0
  14. data/app/assets/fonts/pageflow/sourcesanspro-license.txt +93 -0
  15. data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.eot +0 -0
  16. data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.svg +1153 -839
  17. data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.ttf +0 -0
  18. data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.woff +0 -0
  19. data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.eot +0 -0
  20. data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.svg +1252 -199
  21. data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.ttf +0 -0
  22. data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.woff +0 -0
  23. data/app/assets/javascripts/pageflow/base.js +2 -0
  24. data/app/assets/javascripts/pageflow/browser/agent.js +25 -0
  25. data/app/assets/javascripts/pageflow/browser/css_animations.js +18 -0
  26. data/app/assets/javascripts/pageflow/browser/mobile_platform.js +1 -4
  27. data/app/assets/javascripts/pageflow/browser/video.js +8 -1
  28. data/app/assets/javascripts/pageflow/chapter_filter.js +6 -16
  29. data/app/assets/javascripts/pageflow/editor/api.js +6 -2
  30. data/app/assets/javascripts/pageflow/editor/api/page_type.js +12 -0
  31. data/app/assets/javascripts/pageflow/editor/base.js +4 -0
  32. data/app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js +4 -1
  33. data/app/assets/javascripts/pageflow/editor/collections/chapters_collection.js +1 -5
  34. data/app/assets/javascripts/pageflow/editor/collections/mixins/add_and_return_model.js +11 -0
  35. data/app/assets/javascripts/pageflow/editor/collections/mixins/ordered_collection.js +6 -4
  36. data/app/assets/javascripts/pageflow/editor/collections/ordered_page_links_collection.js +9 -0
  37. data/app/assets/javascripts/pageflow/editor/collections/page_links_collection.js +78 -0
  38. data/app/assets/javascripts/pageflow/editor/collections/pages_collection.js +9 -3
  39. data/app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js +35 -0
  40. data/app/assets/javascripts/pageflow/editor/collections/storylines_collection.js +33 -0
  41. data/app/assets/javascripts/pageflow/editor/controllers/sidebar_controller.js +19 -2
  42. data/app/assets/javascripts/pageflow/editor/initializers/edit_lock.js +1 -1
  43. data/app/assets/javascripts/pageflow/editor/initializers/setup_collections.js +11 -0
  44. data/app/assets/javascripts/pageflow/editor/initializers/setup_common_seed.js +3 -0
  45. data/app/assets/javascripts/pageflow/editor/initializers/stylesheet_reloading.js +11 -0
  46. data/app/assets/javascripts/pageflow/editor/models/chapter.js +14 -7
  47. data/app/assets/javascripts/pageflow/editor/models/chapter_scaffold.js +13 -0
  48. data/app/assets/javascripts/pageflow/editor/models/edit_lock_container.js +4 -4
  49. data/app/assets/javascripts/pageflow/editor/models/entry.js +33 -4
  50. data/app/assets/javascripts/pageflow/editor/models/mixins/persited_promise.js +18 -0
  51. data/app/assets/javascripts/pageflow/editor/models/page.js +4 -0
  52. data/app/assets/javascripts/pageflow/editor/models/page_link.js +37 -0
  53. data/app/assets/javascripts/pageflow/editor/models/page_link_file_selection_handler.js +14 -0
  54. data/app/assets/javascripts/pageflow/editor/models/preview_entry_data.js +15 -0
  55. data/app/assets/javascripts/pageflow/editor/models/scaffold.js +26 -0
  56. data/app/assets/javascripts/pageflow/editor/models/storyline.js +99 -0
  57. data/app/assets/javascripts/pageflow/editor/models/storyline_configuration.js +15 -0
  58. data/app/assets/javascripts/pageflow/editor/models/storyline_ordering.js +117 -0
  59. data/app/assets/javascripts/pageflow/editor/models/storyline_scaffold.js +23 -0
  60. data/app/assets/javascripts/pageflow/editor/models/storyline_transitive_child_pages.js +33 -0
  61. data/app/assets/javascripts/pageflow/editor/routers/sidebar_router.js +3 -0
  62. data/app/assets/javascripts/pageflow/editor/templates/edit_entry.jst.ejs +1 -6
  63. data/app/assets/javascripts/pageflow/editor/templates/edit_page_link.jst.ejs +3 -0
  64. data/app/assets/javascripts/pageflow/editor/templates/edit_storyline.jst.ejs +12 -0
  65. data/app/assets/javascripts/pageflow/editor/templates/page_link_item.jst.ejs +1 -0
  66. data/app/assets/javascripts/pageflow/editor/templates/page_selection.jst.ejs +2 -2
  67. data/app/assets/javascripts/pageflow/editor/templates/storyline_outline.jst.ejs +4 -0
  68. data/app/assets/javascripts/pageflow/editor/templates/storyline_picker.jst.ejs +7 -0
  69. data/app/assets/javascripts/pageflow/editor/utils/reload_stylesheet.js +9 -0
  70. data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/options.js +2 -2
  71. data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/page_link.js +10 -0
  72. data/app/assets/javascripts/pageflow/editor/views/edit_chapter_view.js +0 -4
  73. data/app/assets/javascripts/pageflow/editor/views/edit_entry_view.js +9 -15
  74. data/app/assets/javascripts/pageflow/editor/views/edit_meta_data_view.js +14 -6
  75. data/app/assets/javascripts/pageflow/editor/views/edit_page_link_view.js +47 -0
  76. data/app/assets/javascripts/pageflow/editor/views/edit_storyline_view.js +97 -0
  77. data/app/assets/javascripts/pageflow/editor/views/editor_view.js +6 -3
  78. data/app/assets/javascripts/pageflow/editor/views/entry_preview_view.js +13 -7
  79. data/app/assets/javascripts/pageflow/editor/views/file_item_view.js +1 -1
  80. data/app/assets/javascripts/pageflow/editor/views/inputs/page_link_input_view.js +3 -1
  81. data/app/assets/javascripts/pageflow/editor/views/locked_view.js +3 -3
  82. data/app/assets/javascripts/pageflow/editor/views/mixins/loadable.js +1 -1
  83. data/app/assets/javascripts/pageflow/editor/views/page_item_view.js +2 -0
  84. data/app/assets/javascripts/pageflow/editor/views/page_link_configuration_editor_view.js +7 -0
  85. data/app/assets/javascripts/pageflow/editor/views/page_link_item_view.js +8 -1
  86. data/app/assets/javascripts/pageflow/editor/views/page_preview_view.js +1 -1
  87. data/app/assets/javascripts/pageflow/editor/views/page_selection_view.js +13 -12
  88. data/app/assets/javascripts/pageflow/editor/views/storyline_outline_view.js +33 -0
  89. data/app/assets/javascripts/pageflow/editor/views/storyline_picker_view.js +114 -0
  90. data/app/assets/javascripts/pageflow/entry_data.js +38 -4
  91. data/app/assets/javascripts/pageflow/highlighted_page.js +5 -5
  92. data/app/assets/javascripts/pageflow/history.js +1 -1
  93. data/app/assets/javascripts/pageflow/native_scrolling.js +14 -0
  94. data/app/assets/javascripts/pageflow/page_transitions.js +3 -1
  95. data/app/assets/javascripts/pageflow/page_type.js +2 -0
  96. data/app/assets/javascripts/pageflow/ready.js +4 -1
  97. data/app/assets/javascripts/pageflow/seed_entry_data.js +28 -1
  98. data/app/assets/javascripts/pageflow/slideshow.js +11 -8
  99. data/app/assets/javascripts/pageflow/slideshow/dom_order_scroll_navigator.js +93 -8
  100. data/app/assets/javascripts/pageflow/slideshow/hidden_text_indicator_widget.js +5 -3
  101. data/app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js +4 -0
  102. data/app/assets/javascripts/pageflow/slideshow/page_widget.js +15 -6
  103. data/app/assets/javascripts/pageflow/ui/templates/tooltip.jst.ejs +2 -0
  104. data/app/assets/javascripts/pageflow/ui/views/inputs/text_area_input_view.js +17 -4
  105. data/app/assets/javascripts/pageflow/ui/views/mixins/tooltip_container.js +42 -0
  106. data/app/assets/javascripts/pageflow/ui/views/tooltip_view.js +49 -0
  107. data/app/assets/javascripts/pageflow/video_player.js +2 -2
  108. data/app/assets/javascripts/pageflow/video_player/{filter_for_silk.js → filter_sources.js} +2 -2
  109. data/app/assets/javascripts/pageflow/widgets/navigation.js +17 -14
  110. data/app/assets/javascripts/pageflow/widgets/navigation_mobile.js +7 -2
  111. data/app/assets/javascripts/pageflow/widgets/overview.js +9 -6
  112. data/app/assets/javascripts/pageflow/widgets/page_navigation_list.js +51 -13
  113. data/app/assets/javascripts/pageflow/widgets/page_navigation_list_animation.js +48 -0
  114. data/app/assets/javascripts/pageflow/widgets/parent_page_button.js +9 -2
  115. data/app/assets/stylesheets/pageflow/admin.css.scss +2 -15
  116. data/app/assets/stylesheets/pageflow/admin/features.scss +5 -0
  117. data/app/assets/stylesheets/pageflow/admin/forms.scss +18 -0
  118. data/app/assets/stylesheets/pageflow/animations.css.scss +1 -0
  119. data/app/assets/stylesheets/pageflow/animations/navigation_bar.scss +89 -0
  120. data/app/assets/stylesheets/pageflow/delayed_text_fade_in.css.scss +1 -1
  121. data/app/assets/stylesheets/pageflow/editor/base.css.scss +5 -0
  122. data/app/assets/stylesheets/pageflow/editor/menu.css.scss +1 -0
  123. data/app/assets/stylesheets/pageflow/editor/outline.css.scss +5 -0
  124. data/app/assets/stylesheets/pageflow/editor/page_links.css.scss +9 -1
  125. data/app/assets/stylesheets/pageflow/editor/page_selection.css.scss +7 -1
  126. data/app/assets/stylesheets/pageflow/editor/storyline_picker.css.scss +32 -0
  127. data/app/assets/stylesheets/pageflow/extendables.scss +26 -0
  128. data/app/assets/stylesheets/pageflow/mixins/pageflow.css.scss +25 -0
  129. data/app/assets/stylesheets/pageflow/navigation_bar.css.scss +64 -4
  130. data/app/assets/stylesheets/pageflow/navigation_mobile.css.scss +56 -0
  131. data/app/assets/stylesheets/pageflow/page_transitions.css.scss +4 -1
  132. data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_left.scss +12 -0
  133. data/app/assets/stylesheets/pageflow/page_transitions/scroll_over_from_right.scss +12 -0
  134. data/app/assets/stylesheets/pageflow/page_types/video.css.scss +5 -1
  135. data/app/assets/stylesheets/pageflow/themes/default/page.css.scss +180 -42
  136. data/app/assets/stylesheets/pageflow/ui.css.scss +1 -0
  137. data/app/assets/stylesheets/pageflow/ui/forms.css.scss +11 -2
  138. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.css.scss +1 -0
  139. data/app/assets/stylesheets/pageflow/ui/tabs_view.css.scss +0 -3
  140. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +57 -0
  141. data/app/controllers/concerns/pageflow/entry_password_protection.rb +13 -0
  142. data/app/controllers/pageflow/chapters_controller.rb +24 -9
  143. data/app/controllers/pageflow/edit_locks_controller.rb +2 -2
  144. data/app/controllers/pageflow/editor/files_controller.rb +0 -2
  145. data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
  146. data/app/controllers/pageflow/entries_controller.rb +5 -9
  147. data/app/controllers/pageflow/files_controller.rb +3 -0
  148. data/app/controllers/pageflow/storylines_controller.rb +69 -0
  149. data/app/helpers/pageflow/admin/features_helper.rb +17 -6
  150. data/app/helpers/pageflow/admin/widgets_helper.rb +18 -0
  151. data/app/helpers/pageflow/audio_files_helper.rb +2 -2
  152. data/app/helpers/pageflow/common_entry_seed_helper.rb +52 -0
  153. data/app/helpers/pageflow/entries_helper.rb +7 -1
  154. data/app/helpers/pageflow/entry_json_seed_helper.rb +27 -10
  155. data/app/helpers/pageflow/meta_tags_helper.rb +11 -0
  156. data/app/helpers/pageflow/page_types_helper.rb +9 -5
  157. data/app/helpers/pageflow/pages_helper.rb +9 -96
  158. data/app/helpers/pageflow/public_i18n_helper.rb +13 -0
  159. data/app/helpers/pageflow/social_share_helper.rb +1 -1
  160. data/app/helpers/pageflow/video_files_helper.rb +133 -0
  161. data/app/helpers/pageflow/widgets_helper.rb +3 -9
  162. data/app/models/concerns/pageflow/feature_target.rb +21 -3
  163. data/app/models/concerns/pageflow/hosted_file.rb +4 -0
  164. data/app/models/pageflow/account.rb +2 -2
  165. data/app/models/pageflow/chapter.rb +4 -4
  166. data/app/models/pageflow/chapter_scaffold.rb +33 -0
  167. data/app/models/pageflow/cname_theming_request_scope.rb +7 -1
  168. data/app/models/pageflow/draft_entry.rb +13 -2
  169. data/app/models/pageflow/edit_lock.rb +2 -2
  170. data/app/models/pageflow/entry.rb +3 -2
  171. data/app/models/pageflow/image_file.rb +6 -0
  172. data/app/models/pageflow/published_entry.rb +13 -2
  173. data/app/models/pageflow/revision.rb +17 -4
  174. data/app/models/pageflow/storyline.rb +23 -0
  175. data/app/models/pageflow/storyline_scaffold.rb +27 -0
  176. data/app/models/pageflow/theming.rb +4 -0
  177. data/app/models/pageflow/widget.rb +16 -12
  178. data/app/views/admin/accounts/_form.html.erb +8 -12
  179. data/app/views/admin/accounts/_widgets_inline_help.html.erb +5 -0
  180. data/app/views/layouts/pageflow/application.html.erb +4 -1
  181. data/app/views/pageflow/admin/widgets/_fields.html.erb +9 -0
  182. data/app/views/pageflow/config/_editor_seeds.json.jbuilder +1 -1
  183. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +2 -2
  184. data/app/views/pageflow/editor/entries/_other_entry.json.jbuilder +1 -0
  185. data/app/views/pageflow/editor/entries/index.json.jbuilder +1 -1
  186. data/app/views/pageflow/editor/entries/seed.json.erb +4 -1
  187. data/app/views/pageflow/editor/files/_file.json.jbuilder +4 -0
  188. data/app/views/pageflow/editor/themings/_theming.json.jbuilder +1 -0
  189. data/app/views/pageflow/entries/_entry.html.erb +2 -2
  190. data/app/views/pageflow/entries/_ie8_hint.html.erb +2 -2
  191. data/app/views/pageflow/entries/_indicators.html.erb +3 -3
  192. data/app/views/pageflow/entries/_mobile_navigation.html.erb +6 -5
  193. data/app/views/pageflow/entries/_multimedia_alert.html.erb +6 -6
  194. data/app/views/pageflow/entries/_non_js_hint.html.erb +1 -1
  195. data/app/views/pageflow/entries/_skip_links.html.erb +3 -3
  196. data/app/views/pageflow/entries/edit.html.erb +4 -2
  197. data/app/views/pageflow/entries/navigation/_bar_bottom.html.erb +6 -5
  198. data/app/views/pageflow/entries/navigation/_bar_top.html.erb +13 -13
  199. data/app/views/pageflow/entries/navigation/_home_button.html.erb +2 -2
  200. data/app/views/pageflow/entries/navigation/_page.html.erb +1 -1
  201. data/app/views/pageflow/entries/overview/_chapter.html.erb +1 -1
  202. data/app/views/pageflow/entries/overview/_entry.html.erb +7 -6
  203. data/app/views/pageflow/entries/share_menu/_facebook_link.html.erb +1 -1
  204. data/app/views/pageflow/entries/share_menu/_google_link.html.erb +1 -1
  205. data/app/views/pageflow/entries/share_menu/_twitter_link.html.erb +1 -1
  206. data/app/views/pageflow/entries/show.html.erb +4 -1
  207. data/app/views/pageflow/file_types/_thumbnails.css.erb +2 -0
  208. data/app/views/pageflow/meta_tags/_entry.html.erb +4 -0
  209. data/app/views/pageflow/pages/_page.html.erb +2 -2
  210. data/app/views/pageflow/pages/templates/_audio.html.erb +2 -2
  211. data/app/views/pageflow/pages/templates/_audio_loop.html.erb +1 -1
  212. data/app/views/pageflow/pages/templates/_background_video.html.erb +8 -3
  213. data/app/views/pageflow/pages/templates/_video.html.erb +9 -4
  214. data/app/views/pageflow/public_i18n/_javascript_tag.html.erb +5 -0
  215. data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
  216. data/app/views/pageflow/video_files/_script_tag.html.erb +3 -0
  217. data/app/views/pageflow/video_files/_video_file.html.erb +4 -1
  218. data/app/views/pageflow/video_files/_video_tag.html.erb +7 -0
  219. data/config/initializers/admin_resource_tabs.rb +1 -0
  220. data/config/initializers/features.rb +3 -1
  221. data/config/initializers/paperclip.rb +5 -0
  222. data/config/locales/de.yml +205 -601
  223. data/config/locales/en.yml +198 -405
  224. data/config/routes.rb +10 -2
  225. data/db/migrate/20150826125417_create_pageflow_storylines.rb +12 -0
  226. data/db/migrate/20150826125744_add_storyline_id_to_chapters.rb +6 -0
  227. data/db/migrate/20150826125745_insert_main_storylines.rb +28 -0
  228. data/db/migrate/20150830105831_remove_revision_id_from_chapters.rb +5 -0
  229. data/db/migrate/20150830110006_remove_entry_id_from_chapters.rb +5 -0
  230. data/db/migrate/20160201130118_add_additional_cnames_to_themings.rb +5 -0
  231. data/db/migrate/20160216130336_add_meta_fields_to_revision.rb +7 -0
  232. data/lib/generators/pageflow/initializer/templates/pageflow.rb +7 -0
  233. data/lib/pageflow/ability_mixin.rb +7 -1
  234. data/lib/pageflow/configuration.rb +27 -2
  235. data/lib/pageflow/engine.rb +4 -1
  236. data/lib/pageflow/features.rb +24 -0
  237. data/lib/pageflow/global_config_api.rb +1 -0
  238. data/lib/pageflow/seeds.rb +4 -2
  239. data/lib/pageflow/theme.rb +4 -0
  240. data/lib/pageflow/version.rb +1 -1
  241. data/spec/factories/chapters.rb +6 -3
  242. data/spec/factories/storylines.rb +13 -0
  243. metadata +1021 -928
  244. data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.eot +0 -0
  245. data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.svg +0 -768
  246. data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.ttf +0 -0
  247. data/app/assets/fonts/pageflow/FranklinGothic-Demi-webfont.woff +0 -0
  248. data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.eot +0 -0
  249. data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.svg +0 -968
  250. data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.ttf +0 -0
  251. data/app/assets/fonts/pageflow/FranklinGothic-Hvy-webfont.woff +0 -0
  252. data/app/assets/fonts/pageflow/thesansboldplain.eot +0 -0
  253. data/app/assets/fonts/pageflow/thesansboldplain.svg +0 -228
  254. data/app/assets/fonts/pageflow/thesansboldplain.ttf +0 -0
  255. data/app/assets/fonts/pageflow/thesansboldplain.woff +0 -0
  256. data/app/assets/fonts/pageflow/thesanssemiboldplain.eot +0 -0
  257. data/app/assets/fonts/pageflow/thesanssemiboldplain.svg +0 -228
  258. data/app/assets/fonts/pageflow/thesanssemiboldplain.ttf +0 -0
  259. data/app/assets/fonts/pageflow/thesanssemiboldplain.woff +0 -0
  260. data/app/assets/javascripts/pageflow/browser/hashchange_support.js +0 -8
  261. data/app/assets/javascripts/pageflow/widgets/button.js +0 -22
  262. data/app/views/layouts/pageflow/_meta_tags.html.erb +0 -5
  263. data/app/views/pageflow/pages/_video_tag.html.erb +0 -13
@@ -1,5 +1,9 @@
1
1
  module Pageflow
2
2
  module EntriesHelper
3
+ def pretty_entry_title(entry)
4
+ [entry.title, entry.theming.cname_domain.presence].compact.join(' - ')
5
+ end
6
+
3
7
  def pretty_entry_url(entry)
4
8
  pageflow.short_entry_url(entry.to_model, Pageflow.config.theming_url_options(entry.theming))
5
9
  end
@@ -46,7 +50,9 @@ module Pageflow
46
50
  p: Pageflow::VERSION,
47
51
  format: 'css')
48
52
 
49
- stylesheet_link_tag(url, media: 'all')
53
+ stylesheet_link_tag(url,
54
+ media: 'all',
55
+ data: {name: 'entry'})
50
56
  end
51
57
 
52
58
  def entry_mobile_navigation_pages(entry)
@@ -4,35 +4,52 @@ module Pageflow
4
4
  # @api private
5
5
  module EntryJsonSeedHelper
6
6
  include RenderJsonHelper
7
+ include CommonEntrySeedHelper
7
8
 
8
9
  def entry_json_seed(entry)
9
- seed = {
10
- theming: entry_theming_seed(entry),
11
- chapter_configurations: entry_chapter_configurations_seed(entry),
12
- pages: entry_pages_seed(entry)
13
- }
10
+ sanitize_json(entry_seed(entry).to_json).html_safe
11
+ end
14
12
 
15
- sanitize_json(seed.to_json).html_safe
13
+ def entry_seed(entry)
14
+ common_entry_seed(entry).merge(
15
+ theming: entry_theming_seed(entry),
16
+ storyline_configurations: entry_storyline_configurations_seed(entry),
17
+ chapters: entry_chapters_seed(entry),
18
+ pages: entry_pages_seed(entry),
19
+ file_ids: entry_file_ids_seed(entry)
20
+ )
16
21
  end
17
22
 
18
23
  def entry_theming_seed(entry)
19
24
  {
25
+ change_to_parent_page_at_storyline_boundary: entry.theming.theme.change_to_parent_page_at_storyline_boundary?,
20
26
  page_change_by_scrolling: entry.theming.theme.page_change_by_scrolling?,
21
27
  hide_text_on_swipe: entry.theming.theme.hide_text_on_swipe?
22
28
  }
23
29
  end
24
30
 
25
- def entry_chapter_configurations_seed(entry)
26
- entry.chapters.each_with_object({}) do |chapter, result|
27
- result[chapter.id] = chapter.configuration
31
+ def entry_storyline_configurations_seed(entry)
32
+ entry.storylines.each_with_object({}) do |storyline, result|
33
+ result[storyline.id] = storyline.configuration
28
34
  end
29
35
  end
30
36
 
37
+ def entry_chapters_seed(entry)
38
+ attributes = [:id, :storyline_id, :title, :configuration]
39
+ entry.chapters.as_json(only: attributes)
40
+ end
41
+
31
42
  def entry_pages_seed(entry)
32
- attributes = [:id, :perma_id, :chapter_id, :configuration]
43
+ attributes = [:id, :perma_id, :chapter_id, :template, :configuration]
33
44
  entry.pages.as_json(only: attributes)
34
45
  end
35
46
 
47
+ def entry_file_ids_seed(entry)
48
+ Pageflow.config.file_types.with_thumbnail_support.each_with_object({}) do |file_type, result|
49
+ result[file_type.collection_name] = entry.files(file_type.model).map(&:id)
50
+ end
51
+ end
52
+
36
53
  def entry_audio_files_json_seed(entry)
37
54
  seed = entry.audio_files.each_with_object({}) do |audio_file, result|
38
55
  result[audio_file.id] = audio_file_sources(audio_file)
@@ -0,0 +1,11 @@
1
+ module Pageflow
2
+ module MetaTagsHelper
3
+ def meta_tags_for_entry(entry)
4
+ render partial: 'pageflow/meta_tags/entry', locals: {
5
+ keywords: entry.keywords.presence || Pageflow.config.default_keywords_meta_tag,
6
+ author: entry.author.presence || Pageflow.config.default_author_meta_tag,
7
+ publisher: entry.publisher.presence || Pageflow.config.default_publisher_meta_tag
8
+ }
9
+ end
10
+ end
11
+ end
@@ -8,13 +8,17 @@ module Pageflow
8
8
  as: :page_type)
9
9
  end
10
10
 
11
- def page_type_templates
11
+ def page_type_templates(entry)
12
12
  safe_join(Pageflow.config.page_types.map do |page_type|
13
13
  content_tag(:script,
14
- render_to_string(:template => page_type.template_path,
15
- :locals => {:configuration => {}, :page => Page.new},
16
- :layout => false).to_str,
17
- :type => 'text/html', :data => {:template => "#{page_type.name}_page"})
14
+ render_to_string(template: page_type.template_path,
15
+ locals: {
16
+ configuration: {},
17
+ page: Page.new,
18
+ entry: entry
19
+ },
20
+ layout: false).to_str,
21
+ type: 'text/html', data: {template: "#{page_type.name}_page"})
18
22
  end)
19
23
  end
20
24
  end
@@ -1,5 +1,13 @@
1
1
  module Pageflow
2
2
  module PagesHelper
3
+ def render_page_template(page, locals = {})
4
+ page_type = Pageflow.config.page_types.find_by_name!(page.template)
5
+
6
+ render(template: page_type.template_path,
7
+ locals: locals.merge(page: page,
8
+ configuration: page.configuration))
9
+ end
10
+
3
11
  def page_css_class(page)
4
12
  classes = ['page']
5
13
  classes << 'invert' if page.configuration['invert']
@@ -40,101 +48,6 @@ module Pageflow
40
48
  end
41
49
  end
42
50
 
43
- def mobile_poster_image_div(config = {})
44
- classes = ['background', 'background_image']
45
- position = {x: 50, y: 50}
46
-
47
- if config['mobile_poster_image_id']
48
- classes << "image_#{config['mobile_poster_image_id']}"
49
- position[:x] = config['mobile_poster_image_x'] || 50
50
- position[:y] = config['mobile_poster_image_y'] || 50
51
- elsif config['poster_image_id']
52
- classes << "image_#{config['poster_image_id']}"
53
- position[:x] = config['poster_image_x'] || 50
54
- position[:y] = config['poster_image_y'] || 50
55
- elsif config['video_file_id']
56
- classes << "video_poster_#{config['video_file_id']}"
57
- position[:x] = config['video_file_x'] || 50
58
- position[:y] = config['video_file_y'] || 50
59
- else
60
- classes << 'video_poster_none'
61
- end
62
-
63
- content_tag(:div, '', :class => classes.join(' '),
64
- :style => "background-position: #{position[:x]}% #{position[:y]}%;")
65
- end
66
-
67
- def poster_image_tag(video_id, poster_image_id, options = {})
68
- video_file = VideoFile.find_by_id(video_id)
69
- poster = ImageFile.find_by_id(poster_image_id)
70
-
71
- if poster
72
- options = options.merge('data-src' => poster.attachment.url(:medium))
73
- options = options.merge('data-printsrc' => poster.attachment.url(:print))
74
- elsif video_file
75
- options = options.merge('data-src' => video_file.poster.url(:medium))
76
- options = options.merge('data-printsrc' => video_file.poster.url(:print))
77
- end
78
-
79
- image_tag('', options)
80
- end
81
-
82
- def lookup_video_tag(video_id, poster_image_id, options = {})
83
-
84
- defaults = {:class => ['player video-js video-viewport vjs-default-skin', options.delete(:class)].compact * ' ',
85
- :preload => options.delete(:preload) ? 'metadata' : 'none'}
86
-
87
- options.reverse_merge! defaults
88
- url_options = {:unique_id => options.delete(:unique_id)}
89
-
90
- video_file = VideoFile.find_by_id(video_id)
91
- poster = ImageFile.find_by_id(poster_image_id)
92
- mobile_poster = ImageFile.find_by_id(options.delete(:mobile_poster_image_id))
93
-
94
- options[:data] = {}
95
- script_tag_data = {:template => 'video'}
96
-
97
- if mobile_poster
98
- options[:data][:mobile_poster] = mobile_poster.attachment.url(:medium)
99
- options[:data][:mobile_large_poster] = mobile_poster.attachment.url(:large)
100
- end
101
-
102
- if poster
103
- options[:data][:poster] = poster.attachment.url(:medium)
104
- options[:data][:large_poster] = poster.attachment.url(:large)
105
- elsif video_file
106
- options[:data][:poster] = video_file.poster.url(:medium)
107
- options[:data][:large_poster] = video_file.poster.url(:large)
108
- end
109
-
110
- if video_file && video_file.width.present? && video_file.height.present?
111
- script_tag_data[:video_width] = options[:data][:width] = video_file.width
112
- script_tag_data[:video_height] = options[:data][:height] = video_file.height
113
- end
114
-
115
- render('pageflow/pages/video_tag',
116
- :video_file => video_file, :script_tag_data => script_tag_data,
117
- :options => options, :url_options => url_options)
118
- end
119
-
120
- def video_file_sources(video_file, options = {})
121
- [{
122
- :type => 'video/webm',
123
- :src => video_file.webm_medium.url(options),
124
- :high_src => video_file.webm_high.url(options)
125
- },
126
- {
127
- :type => 'application/x-mpegURL',
128
- :src => video_file.hls_playlist.url(options),
129
- :high_src => video_file.hls_playlist.url(options)
130
- },
131
- {
132
- :type => 'video/mp4',
133
- :src => video_file.mp4_medium.url(options),
134
- :high_src => video_file.mp4_high.url(options)
135
- }]
136
- end
137
-
138
51
  def page_media_breakpoints
139
52
  {
140
53
  :large => :default,
@@ -146,6 +59,6 @@ module Pageflow
146
59
  file_thumbnail_css_class(page.thumbnail_file, hero ? :link_thumbnail_large : :link_thumbnail)
147
60
  end
148
61
 
149
- CSS_RENDERED_THUMBNAIL_STYLES = [:link_thumbnail, :link_thumbnail_large]
62
+ CSS_RENDERED_THUMBNAIL_STYLES = [:thumbnail_large, :navigation_thumbnail_large, :link_thumbnail, :link_thumbnail_large]
150
63
  end
151
64
  end
@@ -0,0 +1,13 @@
1
+ module Pageflow
2
+ module PublicI18nHelper
3
+ def public_i18n_javascript_tag(entry)
4
+ render('pageflow/public_i18n/javascript_tag',
5
+ entry_locale: entry.locale,
6
+ translations: {
7
+ pageflow: {
8
+ public: I18n.t('pageflow.public', locale: entry.locale)
9
+ }
10
+ })
11
+ end
12
+ end
13
+ end
@@ -64,7 +64,7 @@ module Pageflow
64
64
  private
65
65
 
66
66
  def social_share_sanitize(text)
67
- strip_tags(text.gsub(/<br ?\/?>/, ' ').squish)
67
+ HTMLEntities.new.decode(strip_tags(text.gsub(/<br ?\/?>|&nbsp;/, ' ').squish))
68
68
  end
69
69
  end
70
70
  end
@@ -0,0 +1,133 @@
1
+ module Pageflow
2
+ module VideoFilesHelper
3
+ def mobile_poster_image_div(config = {})
4
+ classes = ['background', 'background_image']
5
+ position = {x: 50, y: 50}
6
+
7
+ if config['mobile_poster_image_id']
8
+ classes << "image_#{config['mobile_poster_image_id']}"
9
+ position[:x] = config['mobile_poster_image_x'] || 50
10
+ position[:y] = config['mobile_poster_image_y'] || 50
11
+ elsif config['poster_image_id']
12
+ classes << "image_#{config['poster_image_id']}"
13
+ position[:x] = config['poster_image_x'] || 50
14
+ position[:y] = config['poster_image_y'] || 50
15
+ elsif config['video_file_id']
16
+ classes << "video_poster_#{config['video_file_id']}"
17
+ position[:x] = config['video_file_x'] || 50
18
+ position[:y] = config['video_file_y'] || 50
19
+ else
20
+ classes << 'video_poster_none'
21
+ end
22
+
23
+ content_tag(:div, '',
24
+ class: classes.join(' '),
25
+ style: "background-position: #{position[:x]}% #{position[:y]}%;")
26
+ end
27
+
28
+ def poster_image_tag(video_id, poster_image_id, options = {})
29
+ video_file = VideoFile.find_by_id(video_id)
30
+ poster = ImageFile.find_by_id(poster_image_id)
31
+
32
+ if poster
33
+ options = options.merge('data-src' => poster.attachment.url(:medium))
34
+ options = options.merge('data-printsrc' => poster.attachment.url(:print))
35
+ elsif video_file
36
+ options = options.merge('data-src' => video_file.poster.url(:medium))
37
+ options = options.merge('data-printsrc' => video_file.poster.url(:print))
38
+ end
39
+
40
+ image_tag('', options)
41
+ end
42
+
43
+ def video_file_video_tag(video_file, options = {})
44
+ defaults = {
45
+ class: [
46
+ 'player video-js video-viewport vjs-default-skin',
47
+ options.delete(:class)
48
+ ].compact * ' ',
49
+ preload: options.delete(:preload) ? 'metadata' : 'none'
50
+ }
51
+
52
+ options.reverse_merge! defaults
53
+ url_options = {unique_id: options.delete(:unique_id)}
54
+
55
+ poster = ImageFile.find_by_id(options.delete(:poster_image_id))
56
+ mobile_poster = ImageFile.find_by_id(options.delete(:mobile_poster_image_id))
57
+
58
+ options[:data] = {}
59
+
60
+ if mobile_poster
61
+ options[:data][:mobile_poster] = mobile_poster.attachment.url(:medium)
62
+ options[:data][:mobile_large_poster] = mobile_poster.attachment.url(:large)
63
+ end
64
+
65
+ if poster
66
+ options[:data][:poster] = poster.attachment.url(:medium)
67
+ options[:data][:large_poster] = poster.attachment.url(:large)
68
+ elsif video_file
69
+ options[:data][:poster] = video_file.poster.url(:medium)
70
+ options[:data][:large_poster] = video_file.poster.url(:large)
71
+ end
72
+
73
+ if video_file && video_file.width.present? && video_file.height.present?
74
+ options[:data][:width] = video_file.width
75
+ options[:data][:height] = video_file.height
76
+ end
77
+
78
+ render('pageflow/video_files/video_tag',
79
+ video_file: video_file,
80
+ options: options,
81
+ url_options: url_options)
82
+ end
83
+
84
+ # @deprecated
85
+ def lookup_video_tag(video_id, poster_image_id, options = {})
86
+ video_file_script_tag(video_id, options.merge(poster_image_id: poster_image_id))
87
+ end
88
+
89
+ def video_file_script_tag(video_id, options = {})
90
+ video_file = VideoFile.find_by_id(video_id)
91
+
92
+ script_tag_data = {template: 'video'}
93
+
94
+ if video_file && video_file.width.present? && video_file.height.present?
95
+ script_tag_data[:video_width] = video_file.width
96
+ script_tag_data[:video_height] = video_file.height
97
+ end
98
+
99
+ render('pageflow/video_files/script_tag',
100
+ script_tag_data: script_tag_data,
101
+ video_file: video_file,
102
+ options: options)
103
+ end
104
+
105
+ def video_file_non_js_link(entry, video_file_id)
106
+ if (video_file = VideoFile.find_by_id(video_file_id))
107
+ link_to(t('pageflow.public.play_video'),
108
+ short_video_file_path(entry, video_file),
109
+ class: 'hint')
110
+ end
111
+ end
112
+
113
+ def video_file_sources(video_file, options = {})
114
+ [
115
+ {
116
+ type: 'video/webm',
117
+ src: video_file.webm_medium.url(options),
118
+ high_src: video_file.webm_high.url(options)
119
+ },
120
+ {
121
+ type: 'application/x-mpegURL',
122
+ src: video_file.hls_playlist.url(options),
123
+ high_src: video_file.hls_playlist.url(options)
124
+ },
125
+ {
126
+ type: 'video/mp4',
127
+ src: video_file.mp4_medium.url(options),
128
+ high_src: video_file.mp4_high.url(options)
129
+ }
130
+ ]
131
+ end
132
+ end
133
+ end
@@ -1,7 +1,7 @@
1
1
  module Pageflow
2
2
  module WidgetsHelper
3
3
  def render_widget_head_fragments(entry, options = {})
4
- fragments = entry.widgets.resolve(options).map do |widget|
4
+ fragments = entry.resolve_widgets(options).map do |widget|
5
5
  widget.widget_type.render_head_fragment(self, entry)
6
6
  end
7
7
 
@@ -9,7 +9,7 @@ module Pageflow
9
9
  end
10
10
 
11
11
  def render_widgets(entry, options = {})
12
- fragments = entry.widgets.resolve(options).map do |widget|
12
+ fragments = entry.resolve_widgets(options).map do |widget|
13
13
  widget.widget_type.render(self, entry)
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ module Pageflow
17
17
  end
18
18
 
19
19
  def present_widgets_css_class(entry)
20
- entry.widgets.resolve.map do |widget|
20
+ entry.resolve_widgets.map do |widget|
21
21
  "widget_#{widget.widget_type.name}_present"
22
22
  end.join(' ')
23
23
  end
@@ -33,11 +33,5 @@ module Pageflow
33
33
  end
34
34
  end.to_json.html_safe
35
35
  end
36
-
37
- def widget_types_collection_for_role(config, role)
38
- config.widget_types.find_all_by_role(role).each_with_object({}) do |widget_type, result|
39
- result[I18n.t(widget_type.translation_key)] = widget_type.name
40
- end
41
- end
42
36
  end
43
37
  end
@@ -3,7 +3,8 @@ module Pageflow
3
3
  module FeatureTarget
4
4
  STATE_MAPPING = {
5
5
  true => 'enabled',
6
- false => 'disabled'
6
+ false => 'disabled',
7
+ nil => 'default'
7
8
  }
8
9
 
9
10
  extend ActiveSupport::Concern
@@ -19,15 +20,32 @@ module Pageflow
19
20
  end
20
21
 
21
22
  def feature_state(name)
23
+ state = own_feature_state(name)
24
+ state == nil ? inherited_feature_state(name) : state
25
+ end
26
+
27
+ def own_feature_state(name)
22
28
  features_configuration[name]
23
29
  end
24
30
 
31
+ def inherited_feature_state(name)
32
+ Pageflow.config.features.enabled_by_default?(name)
33
+ end
34
+
25
35
  def feature_states=(states)
26
36
  boolean_states = states.each_with_object({}) do |(key, value), result|
27
- result[key] = (value == true || value == STATE_MAPPING[true])
37
+ if value == true || value == STATE_MAPPING[true]
38
+ result[key] = true
39
+ elsif value == false || value == STATE_MAPPING[false]
40
+ result[key] = false
41
+ elsif value.blank? || value == STATE_MAPPING[nil]
42
+ result[key] = nil
43
+ end
28
44
  end
29
45
 
30
- self.features_configuration = features_configuration.merge(boolean_states)
46
+ self.features_configuration = features_configuration
47
+ .merge(boolean_states)
48
+ .reject { |_, value| value.nil? }
31
49
  end
32
50
 
33
51
  def features_configuration