Sha256: d41dc1904323db24c564cec26050203d5457964515964f7922b679e9ff51e72e
Contents?: true
Size: 985 Bytes
Versions: 36
Compression:
Stored size: 985 Bytes
Contents
module Hyrax module Renderers # This is used by PresentsAttributes to show licenses # e.g.: presenter.attribute_to_html(:rights_statement, render_as: :rights_statement) class RightsStatementAttributeRenderer < AttributeRenderer private ## # Special treatment for license/rights. A URL from the Hyrax gem's config/hyrax.rb is stored in the descMetadata of the # curation_concern. If that URL is valid in form, then it is used as a link. If it is not valid, it is used as plain text. def attribute_value_to_html(value) begin parsed_uri = URI.parse(value) rescue URI::InvalidURIError nil end if parsed_uri.nil? ERB::Util.h(value) else label = Hyrax.config.rights_statement_service_class.new.label(value) { value } %(<a href=#{ERB::Util.h(value)} target="_blank">#{label}</a>) end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems