Module: Spotlight::SolrDocument::UploadedResource

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/spotlight/solr_document/uploaded_resource.rb

Overview

Mixin for SolrDocuments backed by exhibit-specific resources

Instance Method Summary collapse

Instance Method Details

#to_openseadragon(*_args) ⇒ Object



21
22
23
# File 'app/models/concerns/spotlight/solr_document/uploaded_resource.rb', line 21

def to_openseadragon(*_args)
  [uploaded_resource.upload.iiif_tilesource] if uploaded_resource&.upload
end

#uploaded_resourceObject



14
15
16
17
18
19
# File 'app/models/concerns/spotlight/solr_document/uploaded_resource.rb', line 14

def uploaded_resource
  @uploaded_resource ||= GlobalID::Locator.locate first(Spotlight::Engine.config.resource_global_id_field)
rescue StandardError => e
  Rails.logger.info("Unable to locate uploaded resource: #{e}")
  nil
end