class EmailManager::Generators::ViewsGenerator
Public Instance Methods
copy_controller()
click to toggle source
Addes the controller to the parent project
# File lib/generators/email_manager/views_generator.rb, line 39 def copy_controller template "controllers/email_manager/managed_emails_controller.rb", "app/controllers/email_manager/managed_emails_controller.rb" end
copy_views()
click to toggle source
Adds the views to the parent project
# File lib/generators/email_manager/views_generator.rb, line 27 def copy_views #theoretical support in the future for haml extension = "." + template_engine file_names = %w{index show _pagination _search_form } file_names.each do |file_name| source = "views/email_manager/managed_emails/" + file_name + ".html" + extension destination = "app/views/email_manager/managed_emails/" + file_name + ".html" + extension copy_file source, destination end end
template_engine()
click to toggle source
Stolen from Kaminari gem @returns [String] either ‘haml’ or ‘erb’ based on the user input (which is set to template_engine
)
# File lib/generators/email_manager/views_generator.rb, line 17 def template_engine te = options[:template_engine].try(:to_s).try(:downcase) || 'erb' if te == "haml" return "haml" else return "erb" end end