Module: Pageflow::EntryJsonSeedHelper Private
- Includes:
- CommonEntrySeedHelper, RenderJsonHelper
- Included in:
- PageBackgroundAssetHelper
- Defined in:
- app/helpers/pageflow/entry_json_seed_helper.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Render seed data for published entries.
Constant Summary
Constants included from RenderJsonHelper
RenderJsonHelper::ESCAPED_CHARS, RenderJsonHelper::ESCAPED_CHARS_REGEX
Instance Method Summary collapse
- #entry_attributes_seed(entry) ⇒ Object private
- #entry_audio_files_json_seed(entry) ⇒ Object private
- #entry_chapters_seed(entry) ⇒ Object private
- #entry_file_ids_seed(entry) ⇒ Object private
- #entry_json_seed(entry) ⇒ Object private
- #entry_pages_seed(entry) ⇒ Object private
- #entry_storylines_seed(entry) ⇒ Object private
- #entry_theme_seed(entry) ⇒ Object private
- #entry_widgets_seed(entry) ⇒ Object private
Methods included from CommonEntrySeedHelper
Methods included from RenderJsonHelper
#render_html_partial, #render_json_partial, #render_json_seed, #render_with_format, #sanitize_json
Instance Method Details
#entry_attributes_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 14 def entry_attributes_seed(entry) { title: entry.title, slug: entry.slug, published_at: entry.published_at.try(:iso8601, 0) } end |
#entry_audio_files_json_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 60 61 62 63 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 57 def entry_audio_files_json_seed(entry) seed = entry.audio_files.each_with_object({}) do |audio_file, result| result[audio_file.id] = audio_file_sources(audio_file) end sanitize_json(seed.to_json).html_safe end |
#entry_chapters_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 36 def entry_chapters_seed(entry) attributes = [:id, :storyline_id, :title, :configuration] entry.chapters.as_json(only: attributes) end |
#entry_file_ids_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 55 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 51 def entry_file_ids_seed(entry) Pageflow.config.file_types.with_thumbnail_support.each_with_object({}) do |file_type, result| result[file_type.collection_name] = entry.find_files(file_type.model).map(&:id) end end |
#entry_json_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 9 def entry_json_seed(entry) sanitize_json(render_json_partial('pageflow/entry_json_seed/entry', entry: entry)).html_safe end |
#entry_pages_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 41 def entry_pages_seed(entry) attributes = [:id, :perma_id, :chapter_id, :template, :configuration] entry.pages.as_json(only: attributes) end |
#entry_storylines_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 31 def entry_storylines_seed(entry) attributes = [:id, :configuration] entry.storylines.as_json(only: attributes) end |
#entry_theme_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 22 def entry_theme_seed(entry) theme = entry.theme { change_to_parent_page_at_storyline_boundary: theme.change_to_parent_page_at_storyline_boundary?, page_change_by_scrolling: theme.page_change_by_scrolling?, hide_text_on_swipe: theme.hide_text_on_swipe? } end |
#entry_widgets_seed(entry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 46 def (entry) attributes = [:type_name, :role, :configuration] entry..as_json(only: attributes) end |