Module: Pageflow::EntryJsonSeedHelper Private
- Includes:
- CommonEntrySeedHelper, FilesHelper, 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 FilesHelper
#file_dimensions, #file_duration, #file_format, #files_json_seed
Methods included from RenderJsonHelper
#render_html_partial, #render_json, #render_json_partial, #render_json_seed, #sanitize_json
Methods included from CommonEntrySeedHelper
Methods included from ConfigHelper
#config_file_model_types_seed, #config_file_url_templates_seed
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.
15 16 17 18 19 20 21 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 15 def entry_attributes_seed(entry) { title: entry.title, slug: entry.slug, published_at: entry.published_at.try(:utc).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.
58 59 60 61 62 63 64 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 58 def entry_audio_files_json_seed(entry) seed = entry.find_files(AudioFile).each_with_object({}) do |audio_file, result| result[audio_file.perma_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.
52 53 54 55 56 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 52 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(&:perma_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.
10 11 12 13 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 10 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.
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_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.
32 33 34 35 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 32 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.
23 24 25 26 27 28 29 30 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 23 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.
47 48 49 50 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 47 def (entry) attributes = [:type_name, :role, :configuration] entry..as_json(only: attributes) end |