Class: Pulitzer::GeneratorElementType

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/pulitzer/post_type_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(element_type) ⇒ GeneratorElementType

Returns a new instance of GeneratorElementType.



5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/pulitzer/post_type_generator.rb', line 5

def initialize(element_type)
  case element_type.class.name
  when "Pulitzer::PostTypeContentElementType"
    @label = element_type.label
    @kind = 'content_element'
  when 'Pulitzer::FreeFormSectionType'
    @label = element_type.name
    @kind = 'free_form_section'
  end
end

Instance Method Details

#content_element_injection_contentObject



21
22
23
24
25
26
# File 'lib/generators/pulitzer/post_type_generator.rb', line 21

def content_element_injection_content
  <<-VIEW
  <%= render_cms_element @post.content_element('#{@label}') %>

  VIEW
end

#free_form_section_injection_contentObject



28
29
30
31
32
33
# File 'lib/generators/pulitzer/post_type_generator.rb', line 28

def free_form_section_injection_content
  <<-VIEW
  <%= render_cms_section(@post, '#{@label}') %>

  VIEW
end

#injection_contentObject



16
17
18
19
# File 'lib/generators/pulitzer/post_type_generator.rb', line 16

def injection_content
  injection_content_method = "#{@kind}_injection_content"
  send injection_content_method
end