Sha256: 7105b874f1a66256b13c38efd867e03f411cf0dae1987692575cf28584b349c7

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

module PageflowScrolled
  # Render seed data for published scrolled entries.
  #
  # @api private
  module EntryJsonSeedHelper
    include Pageflow::ConfigHelper
    include Pageflow::RenderJsonHelper
    include Pageflow::FilesHelper
    include Pageflow::EntriesHelper
    include Pageflow::MetaTagsHelper
    include Pageflow::SocialShareLinksHelper
    include PageflowScrolled::I18nHelper
    include PageflowScrolled::ThemesHelper

    def scrolled_entry_json_seed_script_tag(scrolled_entry, options = {})
      seed_json = render_json do |json|
        scrolled_entry_json_seed(json, scrolled_entry, options)
      end

      content_tag(:script, <<-JS.html_safe)
        pageflowScrolledRender(#{sanitize_json(seed_json)});
      JS
    end

    def scrolled_entry_json_seed(json, scrolled_entry, options = {})
      main_storyline = Storyline.all_for_revision(scrolled_entry.revision).first
      main_storyline ||= Storyline.new

      json.partial!('pageflow_scrolled/entry_json_seed/entry',
                    chapters: main_storyline.chapters,
                    entry: scrolled_entry,
                    entry_config: Pageflow.config_for(scrolled_entry),
                    sections: main_storyline.sections,
                    content_elements: main_storyline.content_elements,
                    options: options)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pageflow-15.6.1 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.6.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.5.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.4.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.3.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb