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

- (Object) app_name (readonly)

Returns the value of attribute app_name



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

def app_name
  @app_name
end

- (Object) container_class (readonly)

Returns the value of attribute container_class



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

def container_class
  @container_class
end

Instance Method Details

- (Object) generate_layout



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

def generate_layout
  app = ::Rails.application
  @app_name = app.class.to_s.split("::").first
  @container_class = layout_type == "fluid" ? "container-fluid" : "container"
  template "layout.html.haml", "app/views/layouts/#{layout_name}.html.haml"
  if File.exists?("app/views/layouts/#{layout_name}.html.erb")
    puts "Remove app/views/layouts/#{layout_name}.html.erb to make haml-layout work."
  end
end