Class: ModsDisplay::Location
- Defined in:
- lib/mods_display/fields/location.rb
Instance Method Summary collapse
Methods inherited from Field
Constructor Details
This class inherits a constructor from ModsDisplay::Field
Instance Method Details
#fields ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mods_display/fields/location.rb', line 3 def fields return_fields = [] @values.each do |location| location.children.each do |child| next unless location_field_keys.include?(child.name.to_sym) if child.name.to_sym == :url loc_label = displayLabel(location) || I18n.t('mods_display.location') value = "<a href='#{child.text}'>#{(displayLabel(child) || child.text).gsub(/:$/, '')}</a>" else loc_label = location_label(child) || displayLabel(location) || I18n.t('mods_display.location') value = child.text end return_fields << ModsDisplay::Values.new( label: loc_label || displayLabel(location) || I18n.t('mods_display.location'), values: [value] ) end end collapse_fields(return_fields) end |