Sha256: 096efc29b70bd00bd777bd6adc872c80acf91ba940f9a32a911222f6f506c045

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

class Pulitzer::CreateFreeFormSectionPartials

  def initialize(partial_type)
    @partial_type = partial_type
  end

  def call
    free_form_section_type  = @partial_type.free_form_section_type
    post_type_version       = free_form_section_type.post_type_version
    post_type_version.posts.each do |post|
      if post.preview_version
        free_form_section = post.preview_version.free_form_sections.find_by(name: free_form_section_type.name)
        partial = free_form_section.partials.create do |p|
          p.label         = @partial_type.label
          p.sort_order    = @partial_type.sort_order
          p.post_type_id  = @partial_type.post_type_id
          p.layout_id      = @partial_type.layout_id
        end
        Pulitzer::CreatePartialContentElements.new(partial).call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pulitzer-0.15.0 app/interactions/pulitzer/create_free_form_section_partials.rb