app/models/spotlight/exhibit.rb in blacklight-spotlight-0.3.1 vs app/models/spotlight/exhibit.rb in blacklight-spotlight-0.4.1

- old
+ new

@@ -8,32 +8,34 @@ has_many :searches, dependent: :destroy, extend: FriendlyId::FinderMethods has_many :pages, dependent: :destroy has_many :about_pages, extend: FriendlyId::FinderMethods has_many :feature_pages, extend: FriendlyId::FinderMethods has_one :home_page - has_one :masthead + belongs_to :masthead, dependent: :destroy + belongs_to :thumbnail, class_name: "Spotlight::FeaturedImage", dependent: :destroy has_many :users, through: :roles, class_name: '::User' has_many :custom_fields, dependent: :delete_all has_many :contacts, dependent: :delete_all # These are the contacts who appear in the sidebar has_many :contact_emails, dependent: :delete_all # These are the contacts who get "Contact us" emails has_many :main_navigations, dependent: :delete_all has_many :solr_document_sidecars, dependent: :delete_all has_many :roles, dependent: :delete_all has_many :attachments, dependent: :destroy - has_one :blacklight_configuration, class_name: Spotlight::BlacklightConfiguration, dependent: :delete + has_one :blacklight_configuration, class_name: "Spotlight::BlacklightConfiguration", dependent: :delete has_many :resources accepts_nested_attributes_for :solr_document_sidecars accepts_nested_attributes_for :attachments accepts_nested_attributes_for :blacklight_configuration, update_only: true accepts_nested_attributes_for :searches accepts_nested_attributes_for :about_pages accepts_nested_attributes_for :feature_pages accepts_nested_attributes_for :home_page, update_only: true accepts_nested_attributes_for :masthead, update_only: true + accepts_nested_attributes_for :thumbnail, update_only: true accepts_nested_attributes_for :main_navigations accepts_nested_attributes_for :contacts accepts_nested_attributes_for :contact_emails, reject_if: proc {|attr| attr['email'].blank?} accepts_nested_attributes_for :roles, allow_destroy: true, reject_if: proc {|attr| attr['user_key'].blank?} accepts_nested_attributes_for :custom_fields @@ -47,12 +49,10 @@ after_create :initialize_config after_create :initialize_browse after_create :initialize_main_navigation before_save :sanitize_description - mount_uploader :featured_image, Spotlight::FeaturedImageUploader - after_destroy do # Touch the default exhibit to ensure caching knows that # the exhibits have changed. Spotlight::Exhibit.default.touch end @@ -113,20 +113,23 @@ def reindex_later Spotlight::ReindexJob.perform_later(self) end + def uploaded_resource_fields + Spotlight::Engine.config.upload_fields + end + protected def initialize_config self.blacklight_configuration ||= Spotlight::BlacklightConfiguration.create! end def initialize_browse return unless self.searches.blank? self.searches.create title: "All Exhibit Items", - short_description: "Search results for all items in this exhibit", long_description: "All items in this exhibit." end def initialize_main_navigation self.default_main_navigations.each_with_index do |nav_type, weight|