Sha256: cc285630d91e8dfb8a7e59b54fa6324e3b3067960a3945b2eeb64352af54af22

Contents?: true

Size: 679 Bytes

Versions: 33

Compression:

Stored size: 679 Bytes

Contents

module Spotlight
  module SolrDocument
    ##
    # Mixin for SolrDocuments backed by exhibit-specific resources
    module UploadedResource
      extend ActiveSupport::Concern

      included do
        accepts_nested_attributes_for :uploaded_resource
      end

      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

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
blacklight-spotlight-1.4.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.3.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.2.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.1.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.0.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.0.0.alpha2 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-1.0.0.alpha1 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.34.1 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.34.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.33.3 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.33.2 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.33.1 app/models/concerns/spotlight/solr_document/uploaded_resource.rb
blacklight-spotlight-0.33.0 app/models/concerns/spotlight/solr_document/uploaded_resource.rb