Sha256: 3b85ccd9061a6829bbe87b200ed84b8c38ba9fcb1305a52ecd99c25a4169096d
Contents?: true
Size: 872 Bytes
Versions: 23
Compression:
Stored size: 872 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(["GenericContent"]) # => 'generic_content' # type_field_to_partial_name(["text.pdf"]) # => 'text_pdf' def type_field_to_partial_name(document, display_type) str = Array(display_type).join(' '.freeze).underscore if Rails.version >= '5.0.0' str.parameterize(separator: '_'.freeze) else str.parameterize('_'.freeze) end end end end
Version data entries
23 entries across 23 versions & 1 rubygems