Sha256: 38d77abf165041596f1d7febd4c7219bee146eeb832cc76c17b093d8d2184efa

Contents?: true

Size: 882 Bytes

Versions: 13

Compression:

Stored size: 882 Bytes

Contents

module CurationConcerns
  module Renderers
    class RightsAttributeRenderer < AttributeRenderer
      private

        def attribute_value_to_html(value)
          rights_attribute_to_html(value)
        end

        ##
        # Special treatment for license/rights.  A URL from the Sufia gem's config/sufia.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 rights_attribute_to_html(value)
          begin
            parsed_uri = URI.parse(value)
          rescue
            nil
          end
          if parsed_uri.nil?
            ERB::Util.h(value)
          else
            %(<a href=#{ERB::Util.h(value)} target="_blank">#{CurationConcerns.config.license_service_class.new.label(value)}</a>)
          end
        end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.7 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-2.0.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-2.0.0.rc2 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.6 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.5 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.4 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.3 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.2 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-2.0.0.rc1 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.1 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.7.0.beta1 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb