diff --git a/app/helpers/record_helper.rb b/app/helpers/record_helper.rb index e9ae0ac6..cc42d29c 100644 --- a/app/helpers/record_helper.rb +++ b/app/helpers/record_helper.rb @@ -98,32 +98,16 @@ def access_type(metadata) access_right.first['description'] end - # For GDT records, a 'more information' section includes all fields that are currently mapped in - # [transmogrifier](https://github.com/MITLibraries/transmogrifier/blob/main/transmogrifier/sources/json/aardvark.py). - # Note: the publishers field is not yet available in TIMDEX API, but it should be added here once it is. - def more_info_geo?(metadata) - relevant_fields = %w[alternate_titles contributors dates format identifiers languages locations - links notes provider publishers rights] - metadata.keys.any? { |key| relevant_fields.include? key } - end - def parse_nested_field(field) # Don't continue if it's not a nested field. return unless field.is_a?(Array) && field.first.is_a?(Hash) - # We don't care about display subfields with null values, our the contributors 'mitAffiliated' subfield. + # We don't care about display subfields with null values. field.map do |subfield| - subfield.reject { |key, value| key == 'mitAffiliated' || value.blank? } + subfield.reject { |_, value| value.blank? } end.compact end - def render_subfield(subfield) - # Date ranges are handled differently than other subfields - return ("kind: #{subfield['kind']}; range: " + date_range(subfield['range'])) if subfield['range'].present? - - subfield.map { |key, value| "#{key}: #{value}" }.join('; ') - end - def source_metadata_available?(links) links&.any? { |link| link['kind'] == 'Download' && link['text'] == 'Source Metadata' } end @@ -134,6 +118,12 @@ def source_metadata_link(links) links.select { |link| link['kind'] == 'Download' && link['text'] == 'Source Metadata' }.first['url'] end + def geospatial_coordinates?(locations) + return if locations.blank? + + locations.any? { |location| location['geoshape'] } + end + private def render_kind_value(list) diff --git a/app/models/timdex_record.rb b/app/models/timdex_record.rb index 770e4150..817906bd 100644 --- a/app/models/timdex_record.rb +++ b/app/models/timdex_record.rb @@ -60,7 +60,7 @@ class TimdexRecord < TimdexBase } literaryForm locations { - geopoint + geoshape kind value } diff --git a/app/views/record/_more_info_geo.html.erb b/app/views/record/_more_info_geo.html.erb deleted file mode 100644 index eada63ac..00000000 --- a/app/views/record/_more_info_geo.html.erb +++ /dev/null @@ -1,107 +0,0 @@ -

More information

- - diff --git a/app/views/record/_record_geo.html.erb b/app/views/record/_record_geo.html.erb index c4d0badd..a1e7eaac 100644 --- a/app/views/record/_record_geo.html.erb +++ b/app/views/record/_record_geo.html.erb @@ -19,6 +19,37 @@

<% end %> + <% if @record['alternateTitles'].present? %> +

Alternate titles

+ + <% end %> + + <% if @record['dates'].present? %> +

Dates

+ + <% end %> + + + <% if @record['publishers'].present? %> +

Publishers

+ + <% end %> + <% if @record['summary'].present? %>

Summary

<% @record['summary'].each do |paragraph| %> @@ -37,8 +68,61 @@ <% end %> - <% if more_info_geo?(@record) %> - <%= render partial: 'more_info_geo', locals: { metadata: @record } %> + + <% if geospatial_coordinates?(@record['locations']) %> +

Geospatial coordinates

+ + <% end %> + + <% if @record['notes'].present? %> +

Notes

+ + <% end %> + + <% if @record['provider'].present? %> +

Provider

+

<%= @record['provider'] %>

+ <% end %> + + <% if @record['rights'].present? %> +

Rights

+ + <% end %> + + <% if @record['citation'].present? %> +

Citation

+

<%= @record['citation'] %>

+ <% end %> + + <% if @record['format'].present? %> +

Format

+

<%= @record['format'] %>

+ <% end %> + + <% if @record['languages'].present? %> +

Languages

+ <% end %>