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)


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

def browse_categories?
  searches.published.any?
end

#import(hash) ⇒ Object



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

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

#main_about_pageObject



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

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

#reindex_laterObject



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

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

#reindex_progressObject



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

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

#requested_byObject



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

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

#searchable?Boolean

Returns:

  • (Boolean)


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

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

#set_default_thumbnailObject



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

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

#solr_dataObject



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

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

#to_sObject



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

def to_s
  title
end

#uploaded_resource_fieldsObject



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

def uploaded_resource_fields
  Spotlight::Engine.config.upload_fields
end