Class: Bootstrap::Generators::ThemedGenerator

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

Instance Method Summary collapse

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, *options)
  super(args, *options)
  initialize_views_variables
end

Instance Method Details

#copy_viewsObject



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