Sha256: 6ddf7d560a7a6cb02ee3cc196203cc54127c0a994c276cc6b8fa9ed1ad288acf

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

# Meant to be applied on top of a controller that implements
# Blacklight::SolrHelper. 
module BlacklightUnapi::ControllerExtension
  extend ActiveSupport::Concern

  included do
    helper BlacklightUnapiHelper
  end

  def unapi
    @export_formats = blacklight_config.unapi
    @format = params[:format]

    if params[:id]
      @response, @document = get_solr_response_for_doc_id params[:id]
      @export_formats = @document.export_formats
    end
	 	
    if params[:format]
      respond_to do |format|
        format.all do
          if @document.will_export_as @format
            send_data @document.export_as(@format), type: @document.export_formats[@format][:content_type], disposition: 'inline'
          end
        end
      end
    else
      render template: 'catalog/formats.xml'
    end 	
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight_unapi-0.1.0 lib/blacklight_unapi/controller_extension.rb