Class: Opinio::Generators::ViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/opinio/views/views_generator.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) copy_views



9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/opinio/views/views_generator.rb', line 9

def copy_views
  html_names = ["_comment", "_comments", "_new", "index"]
  js_names = ["create", "destroy", "reply"]
  html_names.each do |name|
    copy_file "#{name}.html.#{view_language}", "app/views/opinio/comments/#{name}.html.#{view_language}"
  end
  js_names.each do |name|
    copy_file "#{name}.js.erb", "app/views/opinio/comments/#{name}.js.erb"
  end
end

- (Object) view_language



20
21
22
# File 'lib/generators/opinio/views/views_generator.rb', line 20

def view_language
  options.haml? ? 'haml' : 'erb'
end