Class: Bootstrapped::Generators::LayoutGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::Base
- Base
- Bootstrapped::Generators::LayoutGenerator
- Defined in:
- lib/generators/bootstrapped/layout/layout_generator.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#container_class ⇒ Object
readonly
Returns the value of attribute container_class.
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
12 13 14 |
# File 'lib/generators/bootstrapped/layout/layout_generator.rb', line 12 def app_name @app_name end |
#container_class ⇒ Object (readonly)
Returns the value of attribute container_class.
12 13 14 |
# File 'lib/generators/bootstrapped/layout/layout_generator.rb', line 12 def container_class @container_class end |
Instance Method Details
#copy_additional_files ⇒ Object
25 26 27 28 29 |
# File 'lib/generators/bootstrapped/layout/layout_generator.rb', line 25 def copy_additional_files copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb' copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb' copy_file '_flash.html.erb', 'app/views/share/_flash.html.erb' end |
#generate_layout ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/generators/bootstrapped/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" if .haml? template "layout.html.haml", "app/views/layouts/#{layout_name}.html.haml" else template "layout.html.erb", "app/views/layouts/#{layout_name}.html.erb" end end |