Class: Iron::Generators::TemplateGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/iron/template/template_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_template_fileObject



10
11
12
13
# File 'lib/generators/iron/template/template_generator.rb', line 10

def create_template_file
  @content_type = Iron::ContentType.find_by!(handle: content_type_handle)
  template "content_type.html.erb", "app/views/templates/#{content_type_handle}.html.erb"
end

#display_instructionsObject



15
16
17
18
19
20
21
22
# File 'lib/generators/iron/template/template_generator.rb', line 15

def display_instructions
  say "\n=== Template created for '#{content_type_name}' ===\n", :green
  say "You can now customize the template at:"
  say "  app/views/templates/#{content_type_handle}.html.erb"
  say "\nAvailable variables in the template:"
  say "  @entry - The current entry with all its fields"
  say "  @content_type - The content type definition"
end