Class: Spotlight::Resources::Upload

Inherits:
Spotlight::Resource show all
Includes:
ImageDerivatives
Defined in:
app/models/spotlight/resources/upload.rb

Overview

Exhibit-specific resources, created using uploaded and custom fields

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ImageDerivatives

#apply_spotlight_image_derivative_versions

Methods inherited from Spotlight::Resource

#document_model, #enqueued_at, #enqueued_at?, #last_indexed_finished, #reindex_later, #save_and_index, #waiting!

Class Method Details

.fields(exhibit) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/spotlight/resources/upload.rb', line 15

def self.fields(exhibit)
  @fields ||= {}
  @fields[exhibit] ||= begin
    title_field = Spotlight::Engine.config.upload_title_field || OpenStruct.new(field_name: exhibit.blacklight_config.index.title_field)
    [title_field] + exhibit.uploaded_resource_fields
  end
end

Instance Method Details

#compound_idObject



23
24
25
# File 'app/models/spotlight/resources/upload.rb', line 23

def compound_id
  "#{exhibit_id}-#{id}"
end

#sidecarObject



27
28
29
# File 'app/models/spotlight/resources/upload.rb', line 27

def sidecar
  @sidecar ||= document_model.new(id: compound_id).sidecar(exhibit)
end