Module: Pageflow::EntryJsonSeedHelper Private
- Includes:
- 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_chapter_configurations_seed(entry) ⇒ Object private
- #entry_json_seed(entry) ⇒ Object private
- #entry_pages_seed(entry) ⇒ Object private
- #entry_theming_seed(entry) ⇒ Object private
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.
36 37 38 39 40 41 42 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 36 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_chapter_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.
25 26 27 28 29 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 25 def entry_chapter_configurations_seed(entry) entry.chapters.each_with_object({}) do |chapter, result| result[chapter.id] = chapter.configuration 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.
8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 8 def entry_json_seed(entry) seed = { theming: entry_theming_seed(entry), chapter_configurations: entry_chapter_configurations_seed(entry), pages: entry_pages_seed(entry) } sanitize_json(seed.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.
31 32 33 34 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 31 def entry_pages_seed(entry) attributes = [:id, :perma_id, :chapter_id, :configuration] entry.pages.as_json(only: attributes) 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.
18 19 20 21 22 23 |
# File 'app/helpers/pageflow/entry_json_seed_helper.rb', line 18 def entry_theming_seed(entry) { page_change_by_scrolling: entry.theming.theme.page_change_by_scrolling?, hide_text_on_swipe: entry.theming.theme.hide_text_on_swipe? } end |