Module: BlacklightOaiProvider::Controller

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/blacklight_oai_provider/controller.rb

Instance Method Summary collapse

Instance Method Details

#oaiObject

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.



16
17
18
19
20
21
22
23
24
# File 'app/controllers/concerns/blacklight_oai_provider/controller.rb', line 16

def oai
  options = params.delete_if { |k, _| %w[controller action].include?(k) }
  body = oai_provider
         .process_request(options)
         .gsub('<?xml version="1.0" encoding="UTF-8"?>') do |m|
           "#{m}\n<?xml-stylesheet type=\"text/xsl\" href=\"#{ActionController::Base.helpers.asset_path('blacklight_oai_provider/oai2.xsl')}\"?>\n"
         end
  render text: body, content_type: 'text/xml'
end

#oai_configObject

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.



30
31
32
# File 'app/controllers/concerns/blacklight_oai_provider/controller.rb', line 30

def oai_config
  blacklight_config.oai || {}
end

#oai_providerObject



34
35
36
# File 'app/controllers/concerns/blacklight_oai_provider/controller.rb', line 34

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