Sha256: 0c7d141a7e463a9e6422ac55d06b676b2057d4942e06c4acd677df2b00b94048

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

module Pageflow
  module PageTypesHelper
    include RenderJsonHelper

    def page_type_json_seeds(config)
      render_json_partial('pageflow/page_types/page_type',
                          collection: config.page_types.to_a,
                          as: :page_type)
    end

    def page_type_json_seed(json, page_type)
      if page_type.json_seed_template
        json.partial!(template: page_type.json_seed_template, locals: {page_type: page_type})
      end
    end

    def page_type_templates(entry)
      # Required by RevisionFileHelper#find_file_in_entry
      @entry = entry

      safe_join(Pageflow.config.page_types.map do |page_type|
        content_tag(:script,
                    render(template: page_type.template_path,
                           locals: {
                             configuration: {},
                             page: Page.new,
                             entry: entry
                           },
                           layout: false).to_str,
                    type: 'text/html', data: {template: "#{page_type.name}_page"})
      end)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/helpers/pageflow/page_types_helper.rb
pageflow-17.0.3 app/helpers/pageflow/page_types_helper.rb
pageflow-17.0.2 app/helpers/pageflow/page_types_helper.rb
pageflow-17.0.1 app/helpers/pageflow/page_types_helper.rb
pageflow-17.0.0 app/helpers/pageflow/page_types_helper.rb
pageflow-16.2.0 app/helpers/pageflow/page_types_helper.rb