Class: Bootstrap::Generators::ThemedGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Bootstrap::Generators::ThemedGenerator
- Defined in:
- lib/generators/bootstrap/themed/themed_generator.rb
Instance Method Summary collapse
- #copy_views ⇒ Object
-
#initialize(args, *options) ⇒ ThemedGenerator
constructor
A new instance of ThemedGenerator.
Constructor Details
#initialize(args, *options) ⇒ ThemedGenerator
Returns a new instance of ThemedGenerator.
13 14 15 16 |
# File 'lib/generators/bootstrap/themed/themed_generator.rb', line 13 def initialize(args, *) super(args, *) initialize_views_variables end |
Instance Method Details
#copy_views ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/generators/bootstrap/themed/themed_generator.rb', line 18 def copy_views generate_views gsub_file(File.join('app/views/layouts', "#{layout}.html.erb"), /\<ul\s+class=\"nav\">.*\<\/ul\>/mi) do |match| match.gsub!(/\<\/ul\>/, "") %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>| end end |