app/helpers/blacklight/url_helper_behavior.rb in blacklight-5.7.2 vs app/helpers/blacklight/url_helper_behavior.rb in blacklight-5.8.0
- old
+ new
@@ -17,17 +17,28 @@
else
doc
end
end
+ # link_to_document(doc, 'VIEW', :counter => 3)
# link_to_document(doc, :label=>'VIEW', :counter => 3)
# Use the catalog_path RESTful route to create a link to the show page for a specific item.
# catalog_path accepts a HashWithIndifferentAccess object. The solr query params are stored in the session,
# so we only need the +counter+ param here. We also need to know if we are viewing to document as part of search results.
- def link_to_document(doc, opts={:label=>nil, :counter => nil})
- opts[:label] ||= document_show_link_field(doc)
- label = render_document_index_label doc, opts
+ def link_to_document(doc, field_or_opts = nil, opts={:counter => nil})
+ if field_or_opts.kind_of? Hash
+ opts = field_or_opts
+ if opts[:label]
+ Deprecation.warn self, "The second argument to link_to_document should now be the label."
+ field = opts.delete(:label)
+ end
+ else
+ field = field_or_opts
+ end
+
+ field ||= document_show_link_field(doc)
+ label = presenter(doc).render_document_index_label field, opts
link_to label, url_for_document(doc), document_link_params(doc, opts)
end
def document_link_params(doc, opts)
session_tracking_params(doc, opts[:counter]).deep_merge(opts.except(:label, :counter))
@@ -283,9 +294,19 @@
Deprecation.warn self, "Calling #refworks_export_url without a :url is deprecated. Pass in e.g. { url: url_for_document(@document, format: :refworks_marc_txt) } instead"
params = { url: polymorphic_url(url_for_document(params), format: :refworks_marc_txt, only_path: false) }
end
"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_catalog_path opts = {}
+ if opts[:id]
+ refworks_export_url(url: polymorphic_url(url_for_document(opts[:id]), format: :refworks_marc_txt, only_path: false))
+ end
+ end
+
+ def endnote_catalog_path opts = {}
+ catalog_path(opts.merge(format: 'endnote'))
end
if ::Rails.version < "4.0"
def asset_url *args
"#{request.protocol}#{request.host_with_port}#{asset_path(*args)}"