Class: Bpluser::ControllerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bpluser/controller_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_folders_show_toolObject



19
20
21
22
23
24
25
26
27
# File 'lib/generators/bpluser/controller_generator.rb', line 19

def add_folders_show_tool
  target_file = 'app/controllers/catalog_controller.rb'
  return unless File.read(target_file).include?('folder_item_control')

  marker = 'configure_blacklight do |config|'
  insert_into_file target_file, after: marker do
    "\nconfig.add_show_tools_partial :folder_items, partial: 'folder_item_control'"
  end
end

#inject_application_controller_behaviorObject



9
10
11
12
13
14
15
16
17
# File 'lib/generators/bpluser/controller_generator.rb', line 9

def inject_application_controller_behavior
  target_file = 'app/controllers/application_controller.rb'
  return unless File.read(target_file).include?('Bpluser::Controller')

  marker = 'include Blacklight::Controller'
  insert_into_file target_file, after: marker do
    "\ninclude Bpluser::Controller"
  end
end