Sha256: 5d8efb6899cc87c5fc3e57bb1c8f2f348aa2c7739d310f3108a4ddd84171a032

Contents?: true

Size: 948 Bytes

Versions: 6

Compression:

Stored size: 948 Bytes

Contents

require 'rails/generators'

class BlacklightAdvancedSearchGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  require File.expand_path('../assets_generator.rb', __FILE__)  
  def inject_asset_requires
    BlacklightAdvancedSearch::AssetsGenerator.start
  end
  
  
  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), :class=>'advanced_search'%>"

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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight_advanced_search-5.1.2 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
blacklight_advanced_search-5.1.1 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
blacklight_advanced_search-5.1.0 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
blacklight_advanced_search-5.0.1 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
blacklight_advanced_search-5.0.0 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb
blacklight_advanced_search-2.2.0 lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb