Sha256: 0fc4e8d4993d98c75294229fdb24b181a73ec887414da47405730f7c99d06e3c

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

module BlacklightMarcHelper

  # This method should move to BlacklightMarc in Blacklight 6.x
  def refworks_export_url params = {}
    "http://www.refworks.com/express/expressimport.asp?vendor=#{CGI.escape(params[:vendor] || application_name)}&filter=#{CGI.escape(params[:filter] || "MARC Format")}&encoding=65001" + (("&url=#{CGI.escape(params[:url])}" if params[:url]) || "")
  end

  def refworks_solr_document_path opts = {}
    if opts[:id]
      refworks_export_url(url: solr_document_url(opts[:id], format: :refworks_marc_txt))
    end
  end

  # For exporting a single endnote document. (endnote_catalog_path is defined by blacklight-marc and it is used for multiple document export)
  def single_endnote_catalog_path opts = {}
    solr_document_path(opts.merge(format: 'endnote'))
  end


  # puts together a collection of documents into one refworks export string
  def render_refworks_texts(documents)
    val = ''
    documents.each do |doc|
      if doc.exports_as? :refworks_marc_txt
        val += doc.export_as(:refworks_marc_txt) + "\n"
      end
    end
    val
  end

  # puts together a collection of documents into one endnote export string
  def render_endnote_texts(documents)
    val = ''
    documents.each do |doc|
      if doc.exports_as? :endnote
        val += doc.export_as(:endnote) + "\n"
      end
    end
    val
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-marc-6.3.0 app/helpers/blacklight_marc_helper.rb
blacklight-marc-6.2.0 app/helpers/blacklight_marc_helper.rb
blacklight-marc-6.1.1 app/helpers/blacklight_marc_helper.rb
blacklight-marc-6.1.0 app/helpers/blacklight_marc_helper.rb
blacklight-marc-6.0.0 app/helpers/blacklight_marc_helper.rb