Class: Spotlight::Resources::Upload

Inherits:
Spotlight::Resource show all
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 inherited from Spotlight::Resource

#document_model, #reindex_later, #save_and_index

Class Method Details

.fields(exhibit) ⇒ Object



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

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



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

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

#sidecarObject



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

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