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

Defined Under Namespace

Classes: LegacyImagePyramidTileSource

Instance Method Summary collapse

Instance Method Details

#to_openseadragon(*_args) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/models/concerns/spotlight/solr_document/uploaded_resource.rb', line 19

def to_openseadragon(*_args)
  self[Spotlight::Engine.config.full_image_field].each_with_index.map do |image_url, index|
    { LegacyImagePyramidTileSource.new(
      image_url,
      width: self[:spotlight_full_image_width_ssm][index],
      height: self[:spotlight_full_image_height_ssm][index]
    ) => {} }
  end
end

#uploaded_resourceObject



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

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