Sha256: 3e4b86a6f97cb78af4df7719034ce74bc0640bf5b263e06628a0d440005cff6a

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 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,
                    widgets: scrolled_entry.resolve_widgets(insert_point: :react),
                    options: options)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pageflow-17.0.4 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-17.0.3 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-17.0.2 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-17.0.1 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-17.0.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-16.2.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-16.1.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-16.0.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.8.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.7.1 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb
pageflow-15.7.0 entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb