Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1244 from pulibrary/geo-content-note
Browse files Browse the repository at this point in the history
include contents note from json-ld in geo works
  • Loading branch information
eliotjordan committed May 4, 2017
2 parents f5c3b1a + 44d938d commit de49019
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/forms/hyrax/image_work_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ class ImageWorkForm < ::Hyrax::GeoWorkForm
include ::GeoWorks::BasicGeoMetadataForm
include ::GeoWorks::ExternalMetadataFileForm
self.model_class = ::ImageWork
self.terms += [:viewing_direction, :viewing_hint, :alternative, :edition, :cartographic_scale]
self.terms += [:viewing_direction, :viewing_hint, :alternative, :edition, :cartographic_scale, :contents]
self.required_fields = [:title, :source_metadata_identifier, :rights_statement, :coverage]

def secondary_terms
super + [:cartographic_scale, :alternative, :edition]
super + [:cartographic_scale, :alternative, :edition, :contents]
end
end
end
4 changes: 4 additions & 0 deletions app/models/concerns/solr_geo_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def edition
Array(self[Solrizer.solr_name("edition")])
end

def contents
Array(self[Solrizer.solr_name("contents")])
end

def cartographic_scale
Array(self[Solrizer.solr_name("cartographic_scale")]).first
end
Expand Down
3 changes: 2 additions & 1 deletion app/presenters/image_work_show_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ImageWorkShowPresenter < GeoWorks::ImageWorkShowPresenter
include PlumAttributes
delegate :viewing_hint, :viewing_direction, :logical_order, :logical_order_object, :ocr_language,
:cartographic_projection, :cartographic_scale, :alternative, :edition, :pdf_type, to: :solr_document
:cartographic_projection, :cartographic_scale, :alternative, :edition, :pdf_type,
:contents, to: :solr_document
end
1 change: 1 addition & 0 deletions app/schemas/plum_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class PlumSchema < ActiveTriples::Schema
property :alternative, predicate: ::RDF::Vocab::DC.alternative
property :identifier, predicate: ::RDF::Vocab::DC.identifier
property :replaces, predicate: ::RDF::Vocab::DC.replaces
property :contents, predicate: ::RDF::Vocab::DC.tableOfContents
property :rights_statement, predicate: ::RDF::Vocab::EDM.rights
property :rights_note, predicate: ::RDF::Vocab::DC11.rights
property :source_metadata_identifier, predicate: ::PULTerms.metadata_id
Expand Down
2 changes: 1 addition & 1 deletion spec/forms/hyrax/image_work_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
describe "#secondary_terms" do
subject { form.secondary_terms }
it do
is_expected.to include(:cartographic_scale, :edition, :alternative)
is_expected.to include(:cartographic_scale, :edition, :alternative, :contents)
end
end
end
4 changes: 4 additions & 0 deletions spec/models/solr_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
height_is: 400,
cartographic_scale_tesim: ['Scale 1:2,000,000'],
alternative_tesim: ['Alt title 1', 'Alt title 2'],
contents_tesim: ['Chapter 1', 'Chapter 2'],
viewing_hint_tesim: ["Viewing Hint"],
exhibit_id_tesim: ["test"],
rights_statement_tesim: ["test"],
Expand Down Expand Up @@ -174,5 +175,8 @@
it '#alternative returns multivalued array' do
expect(subject.alternative).to eq(['Alt title 1', 'Alt title 2'])
end
it '#tableOfContents returns multivalued array' do
expect(subject.contents).to eq(['Chapter 1', 'Chapter 2'])
end
end
end

0 comments on commit de49019

Please sign in to comment.