Sha256: d62ec4e8f17e43c61f1886a0d6a50ec4052cfe1704a0c77ae8a05fbfafbbf491

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require 'cql_ruby'

require 'rails'
require 'blacklight'
require 'blacklight_cql'

require 'blacklight_cql/solr_helper_extension'
require 'blacklight_cql/template_helper_extension'


module BlacklightCql
  class Engine < Rails::Engine
  
    
    # Call in after_initialze to make sure the default search_fields are
    # already created, AND the local app has had the opportunity to customize
    # our placeholder search_field.
    config.after_initialize do      
      CatalogController.blacklight_config.configure do |config|
        hash = BlacklightCql::SolrHelperExtension.pseudo_search_field
        config.add_search_field hash[:key], hash
      end
    end
    

   
    require 'blacklight_cql/route_sets'
    initializer "blacklight.cql.routes" do   
      if defined? Blacklight::Routes 
        Blacklight::Routes.send(:include, BlacklightCql::RouteSets)
      end
    end
      

    
    # Wrapping in Dispatcher.to_prepare will, theoretically, take care of things
    # working properly even in development mode with cache_classes=false (per-request
    # class reloading).
    config.to_prepare do
       #Check in  case CatalogController _hasn't_ really been re-loaded
       unless (CatalogController.kind_of?( BlacklightCql::SolrHelperExtension ))
         # Will over-ride #solr_params to deal with CQL
         CatalogController.send(:include, BlacklightCql::SolrHelperExtension)
         
         # Will over-ride helper methods for search form select,  to ensure
         # query is echo'd properly.
         CatalogController.send(:helper, BlacklightCql::TemplateHelperExtension)
       end
    end

    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_cql-1.2.1 lib/blacklight_cql/engine.rb
blacklight_cql-1.2.0 lib/blacklight_cql/engine.rb
blacklight_cql-1.1.0 lib/blacklight_cql/engine.rb