Class: BlacklightAdvancedSearch::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#inject_asset_requiresObject



7
8
9
# File 'lib/generators/blacklight_advanced_search/install_generator.rb', line 7

def inject_asset_requires
  generate "blacklight_advanced_search:assets"
end

#install_localized_search_formObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/blacklight_advanced_search/install_generator.rb', line 12

def install_localized_search_form
  if options[:force] or yes?("Install local search form with advanced link? (y/N)", :green)
    # We're going to copy the search from from actual currently loaded
    # Blacklight into local app as custom local override -- but add our link at the end too. 
    source_file = File.read(File.join(Blacklight.root, "app/views/catalog/_search_form.html.erb"))

    new_file_contents = source_file + "\n\n<%= link_to 'More options', advanced_search_path(params.except(:controller, :action)), :class=>'advanced_search'%>"

    create_file("app/views/catalog/_search_form.html.erb", new_file_contents)      
  end
end