Class: Pulitzer::CreatePostContentElements

Inherits:
Object
  • Object
show all
Defined in:
app/interactions/pulitzer/create_post_content_elements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ CreatePostContentElements

Returns a new instance of CreatePostContentElements.



4
5
6
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 4

def initialize(post)
  self.post = post
end

Instance Attribute Details

#postObject

Returns the value of attribute post.



2
3
4
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 2

def post
  @post
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 8

def call
  post.post_type_content_element_types.each do |cet|
    post.preview_version.content_elements.create do |ce|
      ce.label                          = cet.label
      ce.height                         = cet.height
      ce.width                          = cet.width
      ce.text_editor                    = cet.text_editor
      ce.content_element_type           = cet.content_element_type
      ce.post_type_content_element_type = cet
    end
  end
  post.free_form_section_types.each do |ffst|
    post.preview_version.free_form_sections.create name: ffst.name
  end
end