Sha256: 0c9caff30567796ab986ce145f165875292d2864d5fd6de9f321e9a777410124

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

module Blacklight::Marc
  module Catalog
    extend ActiveSupport::Concern

    included do
      blacklight_config.add_show_tools_partial(:librarian_view, if: :render_librarian_view_control?, define_method: false)
      blacklight_config.add_show_tools_partial(:refworks, if: :render_refworks_action?, modal: false)
      blacklight_config.add_show_tools_partial(:endnote, if: :render_endnote_action?, modal: false, path: :single_endnote_catalog_path, define_method: false)
    end

    def librarian_view
      @response, deprecated_document = search_service.fetch params[:id]
      @document = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_document, "The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0")
      respond_to do |format|
        format.html do
          return render layout: false if request.xhr?
          # Otherwise draw the full page
        end 
      end
    end

    private

    def render_refworks_action? config, options = {}
      options[:document] && options[:document].respond_to?(:export_formats) && options[:document].export_formats.keys.include?(:refworks_marc_txt )
    end

    def render_endnote_action? config, options = {}
      options[:document] && options[:document].respond_to?(:export_formats) && options[:document].export_formats.keys.include?(:endnote )
    end

    def render_librarian_view_control? config, options = {}
      respond_to? :librarian_view_solr_document_path and options[:document] and options[:document].respond_to?(:to_marc)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-marc-7.2.0 lib/blacklight/marc/catalog.rb
blacklight-marc-7.1.1 lib/blacklight/marc/catalog.rb
blacklight-marc-7.1.0 lib/blacklight/marc/catalog.rb
blacklight-marc-7.0.1 lib/blacklight/marc/catalog.rb
blacklight-marc-7.0.0 lib/blacklight/marc/catalog.rb
blacklight-marc-7.0.0.rc1 lib/blacklight/marc/catalog.rb