Module: BlacklightMarcHelper
- Defined in:
- app/helpers/blacklight_marc_helper.rb
Instance Method Summary collapse
-
#bookmarks_export_url(format, params = {}) ⇒ Object
A URL to refworks export, with an embedded callback URL to this app.
- #refworks_export_url(params = {}, *_) ⇒ Object
- #refworks_solr_document_path(opts = {}, *_) ⇒ Object
-
#render_endnote_texts(documents) ⇒ Object
puts together a collection of documents into one endnote export string.
-
#render_refworks_texts(documents) ⇒ Object
puts together a collection of documents into one refworks export string.
-
#single_endnote_catalog_path(opts = {}, **kwargs) ⇒ Object
For exporting a single endnote document.
Instance Method Details
#bookmarks_export_url(format, params = {}) ⇒ Object
A URL to refworks export, with an embedded callback URL to this app. the callback URL is to bookmarks#export, which delivers a list of user’s bookmarks in ‘refworks marc txt’ format – we tell refworks to expect that format.
45 46 47 |
# File 'app/helpers/blacklight_marc_helper.rb', line 45 def bookmarks_export_url(format, params = {}) bookmarks_url(params.merge(format: format, encrypted_user_id: encrypt_user_id(current_or_guest_user.id))) end |
#refworks_export_url(params = {}, *_) ⇒ Object
2 3 4 |
# File 'app/helpers/blacklight_marc_helper.rb', line 2 def refworks_export_url params = {}, *_ "https://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 |
#refworks_solr_document_path(opts = {}, *_) ⇒ Object
6 7 8 9 10 |
# File 'app/helpers/blacklight_marc_helper.rb', line 6 def refworks_solr_document_path opts = {}, *_ if opts[:id] refworks_export_url(url: solr_document_url(opts[:id], format: :refworks_marc_txt)) end end |
#render_endnote_texts(documents) ⇒ Object
puts together a collection of documents into one endnote export string
30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/blacklight_marc_helper.rb', line 30 def render_endnote_texts(documents) val = '' documents.each do |doc| if doc.exports_as? :endnote endnote = doc.export_as(:endnote) val += "#{endnote}\n" if endnote end end val end |
#render_refworks_texts(documents) ⇒ Object
puts together a collection of documents into one refworks export string
19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/blacklight_marc_helper.rb', line 19 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 |
#single_endnote_catalog_path(opts = {}, **kwargs) ⇒ Object
For exporting a single endnote document. (endnote_catalog_path is defined by blacklight-marc and it is used for multiple document export)
13 14 15 |
# File 'app/helpers/blacklight_marc_helper.rb', line 13 def single_endnote_catalog_path opts = {}, **kwargs solr_document_path(opts['id'], **kwargs.merge(opts).merge(format: 'endnote').except('id')) end |