Sha256: 283912f9d642596e3862122513c64105d6275e9f08b52419caa6090c2e5c85e2

Contents?: true

Size: 846 Bytes

Versions: 18

Compression:

Stored size: 846 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">#{RightsService.label(value)}</a>)
          end
        end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
curation_concerns-1.6.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.5.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.4.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.3.3 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.3.2 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.3.1 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.3.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.2.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.1.2 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.1.1 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.1.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta10 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta9 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta8 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta7 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta6 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
curation_concerns-1.0.0.beta5 app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb