Class: KisoThemes::Generators::EmailLayoutGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
HandlerSupport
Defined in:
lib/generators/kiso_themes/email_layout_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_helpersObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/kiso_themes/email_layout_generator.rb', line 19

def add_helpers

  code = <<-INJECTEDCODE

  add_template_helper EmailTemplateHelper
  include Rails.application.routes.url_helpers
  include ActionView::Helpers::UrlHelper
INJECTEDCODE

  inject_into_file( "app/mailers/application_mailer.rb", code, :after => /^class ApplicationMailer < ActionMailer::Base/)

  gsub_file 'app/mailers/application_mailer.rb', 'mailer', 'email'
end

#copy_layoutsObject



13
14
15
16
17
# File 'lib/generators/kiso_themes/email_layout_generator.rb', line 13

def copy_layouts
  abort "You must create a mailer first" and return unless mailer?
  copy_file "views/emails/_email_header.html.#{handler}", "app/views/emails/_email_header.html.#{handler}"
  copy_file "views/emails/_email_footer.html.#{handler}", "app/views/emails/_email_footer.html.#{handler}"
end