Sha256: 96ce0830cc4d66ab923a11d98982206d46454f2d0cb0799d4997283b310348aa

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

class ModsDisplay::RelatedItem < ModsDisplay::Field

  def fields
    return_values = []
    @value.each do |val|
      unless (val.typeOfResource.length > 0 and
              val.typeOfResource.attributes.length > 0 and
              val.typeOfResource.attributes.first.has_key?("collection") and
              val.typeOfResource.attributes.first["collection"].value == "yes")              
        if val.titleInfo.length > 0
          title = val.titleInfo.text.strip
          return_text = title
          location = nil
          location = val.location.url.text if (val.location.length > 0 and
                                               val.location.url.length > 0)
          return_text = "<a href='#{location}'>#{title}</a>" if location
          return_values << ModsDisplay::Values.new(:label => displayLabel(val) || "Related Item", :values => [return_text])
        end
      end
    end
    return_values
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mods_display-0.0.1.beta3 lib/mods_display/fields/related_item.rb
mods_display-0.0.1.beta2 lib/mods_display/fields/related_item.rb
mods_display-0.0.1.beta1 lib/mods_display/fields/related_item.rb