Class: Spotlight::Exhibit

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Includes:
DefaultThumbnailable, ExhibitAnalytics, ExhibitDefaults, ExhibitDocuments
Defined in:
app/models/spotlight/exhibit.rb

Overview

Spotlight exhibit

Instance Method Summary collapse

Methods included from ExhibitDocuments

#solr_documents

Methods included from ExhibitAnalytics

#analytics, #page_analytics

Instance Method Details

#browse_categories?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'app/models/spotlight/exhibit.rb', line 63

def browse_categories?
  searches.published.any?
end

#import(hash) ⇒ Object



71
72
73
74
# File 'app/models/spotlight/exhibit.rb', line 71

def import(hash)
  Spotlight::ExhibitExportSerializer.prepare(self).from_hash(hash)
  self
end

#main_about_pageObject



59
60
61
# File 'app/models/spotlight/exhibit.rb', line 59

def main_about_page
  @main_about_page ||= about_pages.published.first
end

#reindex_laterObject



82
83
84
# File 'app/models/spotlight/exhibit.rb', line 82

def reindex_later
  Spotlight::ReindexJob.perform_later(self)
end

#reindex_progressObject



102
103
104
# File 'app/models/spotlight/exhibit.rb', line 102

def reindex_progress
  @reindex_progress ||= ReindexProgress.new(resources) if resources
end

#requested_byObject



98
99
100
# File 'app/models/spotlight/exhibit.rb', line 98

def requested_by
  roles.first.user if roles.first
end

#searchable?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'app/models/spotlight/exhibit.rb', line 90

def searchable?
  blacklight_config.search_fields.any? { |_k, v| v.enabled && v.include_in_simple_select != false }
end

#set_default_thumbnailObject



94
95
96
# File 'app/models/spotlight/exhibit.rb', line 94

def set_default_thumbnail
  self.thumbnail ||= searches.first.try(:thumbnail)
end

#solr_dataObject



76
77
78
79
80
# File 'app/models/spotlight/exhibit.rb', line 76

def solr_data
  filters.each_with_object({}) do |filter, hash|
    hash.merge! filter.to_hash
  end
end

#to_sObject



67
68
69
# File 'app/models/spotlight/exhibit.rb', line 67

def to_s
  title
end

#uploaded_resource_fieldsObject



86
87
88
# File 'app/models/spotlight/exhibit.rb', line 86

def uploaded_resource_fields
  Spotlight::Engine.config.upload_fields
end