Sha256: 3c5b03a33db36b62f2bba23f314bbf9f7d2a2c0635f2f8d83ad957f4381eb9cf

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

# Meant to be applied on top of a controller that implements
# Blacklight::SolrHelper. Will inject range limiting behaviors
# to solr parameters creation. 
module BlacklightOaiProvider::ControllerExtension
  def self.included(some_class)
    some_class.helper_method :oai_config
  end

  # Action method of our own!
  # Delivers a _partial_ that's a display of a single fields range facets.
  # Used when we need a second Solr query to get range facets, after the
  # first found min/max from result set. 
  def oai
    options = params.delete_if { |k,v| %w{controller action}.include?(k) }
    render :text => oai_provider.process_request(options), :content_type => 'text/xml'
  end

  # Uses Blacklight.config, needs to be modified when
  # that changes to be controller-based. This is the only method
  # in this plugin that accesses Blacklight.config, single point
  # of contact. 
  def oai_config    
    Blacklight.config[:oai] || {}
  end

  def oai_provider
    @oai_provider ||= BlacklightOaiProvider::SolrDocumentProvider.new(self, oai_config)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_oai_provider-0.0.1 lib/blacklight_oai_provider/controller_extension.rb
blacklight_oai_provider-0.0.1pre2 lib/blacklight_oai_provider/controller_extension.rb
blacklight_oai_provider-0.0.1pre1 lib/blacklight_oai_provider/controller_extension.rb