Class: Spotlight::Exhibit

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Includes:
DefaultThumbnailable, ExhibitAnalytics, 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



80
81
82
# File 'app/models/spotlight/exhibit.rb', line 80

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

#searchable?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'app/models/spotlight/exhibit.rb', line 88

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

#set_default_thumbnailObject



92
93
94
# File 'app/models/spotlight/exhibit.rb', line 92

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

#solr_dataObject



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

def solr_data
  { :"#{Spotlight::Engine.config.solr_fields.prefix}spotlight_exhibit_slug_#{slug}#{Spotlight::Engine.config.solr_fields.boolean_suffix}" => true }
end

#to_sObject



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

def to_s
  title
end

#uploaded_resource_fieldsObject



84
85
86
# File 'app/models/spotlight/exhibit.rb', line 84

def uploaded_resource_fields
  Spotlight::Engine.config.upload_fields
end