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)


61
62
63
# File 'app/models/spotlight/exhibit.rb', line 61

def browse_categories?
  searches.published.any?
end

#import(hash) ⇒ Object



69
70
71
72
# File 'app/models/spotlight/exhibit.rb', line 69

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

#main_about_pageObject



57
58
59
# File 'app/models/spotlight/exhibit.rb', line 57

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

#reindex_laterObject



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

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

#searchable?Boolean

Returns:

  • (Boolean)


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

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

#set_default_thumbnailObject



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

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

#solr_dataObject



74
75
76
# File 'app/models/spotlight/exhibit.rb', line 74

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

#to_sObject



65
66
67
# File 'app/models/spotlight/exhibit.rb', line 65

def to_s
  title
end

#uploaded_resource_fieldsObject



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

def uploaded_resource_fields
  Spotlight::Engine.config.upload_fields
end