class Para::Page::SectionGenerator

Public Instance Methods

generate_fields() click to toggle source
# File lib/generators/para/page/section/section_generator.rb, line 17
def generate_fields
  generate 'para:nested_fields', "page_section/#{ singular_namespaced_path }"
end
generate_model() click to toggle source
# File lib/generators/para/page/section/section_generator.rb, line 10
def generate_model
  template(
    "section.rb.erb",
    "app/models/page_section/#{ singular_namespaced_path }.rb"
  )
end
generate_template() click to toggle source
# File lib/generators/para/page/section/section_generator.rb, line 21
def generate_template
  template(
    "section.html.haml.erb",
    "app/views/page_section/#{ plural_namespaced_path }/_#{ singular_namespaced_path }.html.haml"
  )
end

Private Instance Methods

attributes_separated_with_commas() click to toggle source
# File lib/generators/para/page/section/section_generator.rb, line 30
def attributes_separated_with_commas
  if attributes.empty?
    ':title'
  else
    attributes.map { |attribute| ":#{ attribute.name }" }.join(', ')
  end
end