Sha256: 71e08c04ed6c9107cf23dbcb258784e9208d1e41d8a5de51aeafee3d9cad72c9
Contents?: true
Size: 822 Bytes
Versions: 47
Compression:
Stored size: 822 Bytes
Contents
module Hydra module BlacklightHelperBehavior include Blacklight::BlacklightHelperBehavior ## # Given a Fedora uri, generate a reasonable partial name # Rails thinks that periods indicate a filename, so escape them with slashes. # # @param [SolrDocument] document # @param [String, Array] display_type a value suggestive of a partial # @return [String] the name of the partial to render # @example # type_field_to_partial_name(["info:fedora/hull-cModel:genericContent"]) # => 'generic_content' # type_field_to_partial_name(["info:fedora/hull-cModel:text.pdf"]) # => 'text_pdf' def type_field_to_partial_name(document, display_type) Array(display_type).first.gsub(/^[^\/]+\/[^:]+:/,"").gsub("-","_").underscore.parameterize("_") end end end
Version data entries
47 entries across 47 versions & 1 rubygems