Module: Pageflow::EntryJsonSeedHelper Private
- Includes:
- CommonEntrySeedHelper, RenderJsonHelper
- 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 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 14 def entry_attributes_seed(entry) { title: entry.title, slug: entry.slug } 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.
56 57 58 59 60 61 62 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 56 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.
35 36 37 38 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 35 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.
50 51 52 53 54 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 50 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.
40 41 42 43 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 40 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.
30 31 32 33 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 30 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.
21 22 23 24 25 26 27 28 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 21 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.
45 46 47 48 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 45 def (entry) attributes = [:type_name, :role, :configuration] entry..as_json(only: attributes) end |