lib/spotlight/engine.rb in blacklight-spotlight-3.5.0.4 vs lib/spotlight/engine.rb in blacklight-spotlight-3.6.0.beta1
- old
+ new
@@ -5,22 +5,23 @@
# devise must be required to first to ensure we can override devise and invitable views in spotlight correctly
require 'devise'
require 'devise_invitable'
require 'activejob-status'
-require 'blacklight'
require 'autoprefixer-rails'
-require 'friendly_id'
-require 'tophat'
-require 'paper_trail'
+require 'blacklight'
require 'clipboard/rails'
-require 'leaflet-rails'
+require 'faraday'
+require 'faraday/follow_redirects'
+require 'friendly_id'
require 'i18n/active_record'
-require 'spotlight/upload_field_config'
+require 'leaflet-rails'
+require 'paper_trail'
require 'riiif'
-require 'faraday'
-require 'faraday_middleware'
+require 'spotlight/riiif_service'
+require 'spotlight/upload_field_config'
+require 'tophat'
module Spotlight
##
# Spotlight::Engine
# rubocop:disable Metrics/ClassLength
@@ -35,16 +36,14 @@
include BreadcrumbsOnRails::ActionController
end
end
require 'carrierwave'
- require 'underscore-rails'
require 'redcarpet'
require 'github/markup'
require 'openseadragon'
require 'handlebars_assets'
- require 'sprockets/es6'
config.assets.precompile += %w[spotlight/fallback/*.png]
config.autoload_paths += %W[
#{config.root}/app/builders
@@ -65,15 +64,10 @@
FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__) if defined?(FactoryBot)
end
initializer 'spotlight.assets.precompile' do |app|
app.config.assets.precompile += %w[spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg]
-
- Sprockets::ES6.configuration = { 'modules' => 'umd', 'moduleIds' => true }
- # When we upgrade to Sprockets 4, we can ditch sprockets-es6 and config AMD
- # in this way:
- # https://github.com/rails/sprockets/issues/73#issuecomment-139113466
end
def self.user_class
Spotlight::Engine.config.user_class.constantize
end
@@ -112,10 +106,13 @@
config.writable_index = true
# The allowed file extensions for uploading non-repository items.
config.allowed_upload_extensions = %w[jpg jpeg png]
+ # IIIF integration
+ config.iiif_service = Spotlight::RiiifService
+
# Suffixes for spotlight-created solr fields
config.solr_fields = OpenStruct.new
config.solr_fields.prefix = ''
config.solr_fields.boolean_suffix = '_bsi'
config.solr_fields.string_suffix = '_ssim'
@@ -252,15 +249,20 @@
# default email address to send "Report a Problem" feedback to (in addition to any exhibit-specific contacts)
config.default_contact_email = nil
config.spambot_honeypot_email_field = :email_address
- initializer 'blacklight.configuration' do
+ config.to_prepare do
+ Blacklight::Configuration.try(:initialize_default_configuration) unless Blacklight::Configuration.try(:initialized_default_configuration?)
+
# Field containing the last modified date for a Solr document
Blacklight::Configuration.default_values[:index].timestamp_field ||= 'timestamp'
# Default configuration for the browse view
Blacklight::Configuration.default_values[:browse] ||= Blacklight::OpenStructWithHashAccess.new(document_actions: [])
+
+ Blacklight::Configuration.default_values[:search_state_fields] ||= []
+ Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id]
end
# make blacklight configuration play nice with bootstrap_form
# rubocop:disable Lint/SendWithMixinArgument
Blacklight::OpenStructWithHashAccess.send(:extend, ActiveModel::Translation)