Module: IiifPrint::IiifManifestPresenterFactoryDecorator

Defined in:
app/presenters/iiif_print/iiif_manifest_presenter_factory_decorator.rb

Instance Method Summary collapse

Instance Method Details

#buildObject

This will override Hyrax::IiifManifestPresenter::Factory#build and introducing the expected behavior:

  • child work images show as canvases in the parent work manifest

  • child work images show in the uv on the parent show page

  • still create the manifest if the parent work has images attached but the child works do not



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/presenters/iiif_print/iiif_manifest_presenter_factory_decorator.rb', line 8

def build
  ids.map do |id|
    solr_doc = load_docs.find { |doc| doc.id == id }
    next unless solr_doc

    if solr_doc.file_set?
      presenter_class.for(solr_doc)
    elsif Hyrax.config.curation_concerns.include?(solr_doc.hydra_model)
      # look up file set ids and loop through those
      file_set_docs = load_file_set_docs(load_file_set_ids(solr_doc))
      file_set_docs.map { |doc| presenter_class.for(doc) } if file_set_docs.length
    end
  end.flatten.compact
end