Class: Bootstrap::Generators::LayoutGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bootstrap/layout/layout_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



11
12
13
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 11

def app_name
  @app_name
end

#containerObject (readonly)

Returns the value of attribute container.



11
12
13
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 11

def container
  @container
end

Instance Method Details

#copy_filesObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/bootstrap/layout/layout_generator.rb', line 13

def copy_files
  @app_name = Rails.application.class.to_s.split("::").first
  @container= layout_type == "fixed" ? "container" : "container-fluid"

  ext = Rails.application.config.generators.options[:rails][:template_engine] || :slim
  template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
  template "flash.html.#{ext}",  "app/views/layouts/_flash.html.#{ext}"
  template "header.html.#{ext}", "app/views/application/_header.html.#{ext}"
  template "footer.html.#{ext}", "app/views/application/_footer.html.#{ext}"
end