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_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_seed(entry) ⇒ Object private
- #entry_storyline_configurations_seed(entry) ⇒ Object private
- #entry_theming_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_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.
53 54 55 56 57 58 59 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 53 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.
37 38 39 40 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 37 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.
47 48 49 50 51 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 47 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.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 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 9 def entry_json_seed(entry) sanitize_json(entry_seed(entry).to_json).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.
42 43 44 45 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 42 def entry_pages_seed(entry) attributes = [:id, :perma_id, :chapter_id, :template, :configuration] entry.pages.as_json(only: attributes) end |
#entry_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.
13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 13 def entry_seed(entry) common_entry_seed(entry).merge( theming: entry_theming_seed(entry), storyline_configurations: entry_storyline_configurations_seed(entry), chapters: entry_chapters_seed(entry), pages: entry_pages_seed(entry), file_ids: entry_file_ids_seed(entry) ) end |
#entry_storyline_configurations_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 35 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 31 def entry_storyline_configurations_seed(entry) entry.storylines.each_with_object({}) do |storyline, result| result[storyline.id] = storyline.configuration end end |
#entry_theming_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.
23 24 25 26 27 28 29 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 23 def entry_theming_seed(entry) { change_to_parent_page_at_storyline_boundary: entry.theming.theme.change_to_parent_page_at_storyline_boundary?, page_change_by_scrolling: entry.theming.theme.page_change_by_scrolling?, hide_text_on_swipe: entry.theming.theme.hide_text_on_swipe? } end |