Class: Spotlight::Exhibit
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::Exhibit
show all
- Extended by:
- FriendlyId
- Includes:
- ExhibitAnalytics
- Defined in:
- app/models/spotlight/exhibit.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
#analytics, #page_analytics
Class Method Details
.default ⇒ Object
Find or create the default exhibit
57
58
59
60
61
|
# File 'app/models/spotlight/exhibit.rb', line 57
def self.default
self.find_or_create_by!(default: true) do |e|
e.title = 'Default exhibit'.freeze
end
end
|
.default? ⇒ Boolean
63
64
65
|
# File 'app/models/spotlight/exhibit.rb', line 63
def self.default?
where(default: true).any?
end
|
Instance Method Details
#browse_categories? ⇒ Boolean
71
72
73
|
# File 'app/models/spotlight/exhibit.rb', line 71
def browse_categories?
searches.published.any?
end
|
#main_about_page ⇒ Object
67
68
69
|
# File 'app/models/spotlight/exhibit.rb', line 67
def main_about_page
@main_about_page ||= about_pages.published.first
end
|
#reindex_later ⇒ Object
88
89
90
|
# File 'app/models/spotlight/exhibit.rb', line 88
def reindex_later
Spotlight::ReindexJob.perform_later(self)
end
|
#searchable? ⇒ Boolean
96
97
98
|
# File 'app/models/spotlight/exhibit.rb', line 96
def searchable?
blacklight_config.search_fields.any? { |_k, v| v.enabled && v.include_in_simple_select != false }
end
|
#solr_data ⇒ Object
84
85
86
|
# File 'app/models/spotlight/exhibit.rb', line 84
def solr_data
{ :"#{Spotlight::Engine.config.solr_fields.prefix}spotlight_exhibit_slug_#{slug}#{Spotlight::Engine.config.solr_fields.boolean_suffix}" => true }
end
|
#to_s ⇒ Object
75
76
77
|
# File 'app/models/spotlight/exhibit.rb', line 75
def to_s
title
end
|
#uploaded_resource_fields ⇒ Object
92
93
94
|
# File 'app/models/spotlight/exhibit.rb', line 92
def uploaded_resource_fields
Spotlight::Engine.config.upload_fields
end
|