Sha256: dc8046c1714f78794d49831dd20ddc2dc7f1c4af97652a387f8bc6fde5d27327

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 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)
      safe_join(Pageflow.config.page_types.map do |page_type|
        content_tag(:script,
                    render_to_string(template: page_type.template_path,
                                     locals: {
                                       configuration: {},
                                       page: Page.new,
                                       entry: entry,

                                       # Required by RevisionFileHelper#find_file_in_entry
                                       :@entry => entry
                                     },
                                     layout: false).to_str,
                    type: 'text/html', data: {template: "#{page_type.name}_page"})
      end)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pageflow-16.0.0 app/helpers/pageflow/page_types_helper.rb
pageflow-15.8.0 app/helpers/pageflow/page_types_helper.rb
pageflow-15.7.1 app/helpers/pageflow/page_types_helper.rb
pageflow-15.7.0 app/helpers/pageflow/page_types_helper.rb