blacklight-spotlight 3.5.0.4 → 3.6.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/Rakefile +6 -7
- data/app/assets/config/spotlight/manifest.js +1 -0
- data/app/assets/javascripts/spotlight/application.js +14 -14
- data/app/assets/javascripts/spotlight/spotlight.esm.js +7148 -0
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -0
- data/app/assets/javascripts/spotlight/spotlight.js +7148 -15
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +16 -0
- data/app/controllers/concerns/spotlight/base.rb +2 -1
- data/app/controllers/concerns/spotlight/controller.rb +10 -0
- data/app/controllers/spotlight/admin_users_controller.rb +4 -4
- data/app/controllers/spotlight/appearances_controller.rb +6 -6
- data/app/controllers/spotlight/browse_controller.rb +1 -1
- data/app/controllers/spotlight/catalog_controller.rb +20 -15
- data/app/controllers/spotlight/concerns/application_controller.rb +1 -0
- data/app/controllers/spotlight/concerns/catalog_search_context.rb +2 -2
- data/app/controllers/spotlight/contacts_controller.rb +6 -6
- data/app/controllers/spotlight/dashboards_controller.rb +2 -2
- data/app/controllers/spotlight/exhibits_controller.rb +19 -19
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/home_pages_controller.rb +7 -7
- data/app/controllers/spotlight/lock_controller.rb +1 -1
- data/app/controllers/spotlight/metadata_configurations_controller.rb +2 -2
- data/app/controllers/spotlight/pages_controller.rb +4 -3
- data/app/controllers/spotlight/search_configurations_controller.rb +6 -6
- data/app/controllers/spotlight/searches_controller.rb +22 -22
- data/app/controllers/spotlight/solr_controller.rb +1 -1
- data/app/controllers/spotlight/translations_controller.rb +8 -10
- data/app/controllers/spotlight/versions_controller.rb +2 -1
- data/app/helpers/spotlight/application_helper.rb +33 -17
- data/app/helpers/spotlight/crud_link_helpers.rb +12 -2
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/helpers/spotlight/roles_helper.rb +2 -2
- data/app/helpers/spotlight/title_helper.rb +1 -1
- data/app/helpers/spotlight/translations_helper.rb +1 -3
- data/app/javascript/spotlight/admin/add_another.es6 +24 -0
- data/app/javascript/spotlight/admin/add_image_selector.es6 +38 -0
- data/app/javascript/spotlight/admin/add_new_button.es6 +77 -0
- data/app/javascript/spotlight/admin/appearance.es6 +22 -0
- data/app/javascript/spotlight/admin/blacklight_configuration.es6 +65 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/autocompleteable.js +8 -8
- data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/formable.js +1 -1
- data/app/javascript/spotlight/admin/block_mixins/plustextable.js +58 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/block.js +2 -1
- data/app/javascript/spotlight/admin/blocks/browse_block.js +86 -0
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/iframe_block.js +7 -11
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/link_to_search_block.js +0 -2
- data/app/javascript/spotlight/admin/blocks/oembed_block.js +41 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/resources_block.js +45 -42
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/rule_block.js +2 -4
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/search_result_block.js +7 -9
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_base_block.js +22 -22
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_block.js +7 -7
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_carousel_block.js +14 -15
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +147 -0
- data/app/javascript/spotlight/admin/checkbox_submit.es6 +75 -0
- data/app/javascript/spotlight/admin/copy_email_addresses.es6 +5 -0
- data/app/{assets/javascripts/spotlight/admin/crop.es6 → javascript/spotlight/admin/crop.js} +5 -4
- data/app/javascript/spotlight/admin/croppable.es6 +10 -0
- data/app/{assets/javascripts/spotlight/admin/edit_in_place.js → javascript/spotlight/admin/edit_in_place.es6} +6 -13
- data/app/javascript/spotlight/admin/exhibit_tag_autocomplete.es6 +39 -0
- data/app/javascript/spotlight/admin/exhibits.es6 +59 -0
- data/app/{assets/javascripts/spotlight/admin/form_observer.js → javascript/spotlight/admin/form_observer.es6} +23 -21
- data/app/javascript/spotlight/admin/index.js +85 -0
- data/app/javascript/spotlight/admin/locks.es6 +12 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/multi_image_selector.js +2 -1
- data/app/javascript/spotlight/admin/pages.es6 +42 -0
- data/app/{assets/javascripts/spotlight/admin/progress_monitor.js → javascript/spotlight/admin/progress_monitor.es6} +5 -9
- data/app/javascript/spotlight/admin/readonly_checkbox.es6 +8 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/search_typeahead.js +3 -46
- data/app/{assets/javascripts/spotlight/admin/select_related_input.js → javascript/spotlight/admin/select_related_input.es6} +6 -3
- data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_controls.js +6 -4
- data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_limits.js +2 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/spotlight_nestable.js +4 -8
- data/app/javascript/spotlight/admin/tabs.es6 +8 -0
- data/app/{assets/javascripts/spotlight/admin/translation_progress.js → javascript/spotlight/admin/translation_progress.es6} +6 -13
- data/app/{assets/javascripts/spotlight/admin/users.js → javascript/spotlight/admin/users.es6} +7 -17
- data/app/javascript/spotlight/admin/visibility_toggle.es6 +23 -0
- data/app/javascript/spotlight/index.js +10 -0
- data/app/javascript/spotlight/spotlight.js +32 -0
- data/app/{assets/javascripts/spotlight/user/analytics.js → javascript/spotlight/user/analytics.es6} +4 -4
- data/app/{assets/javascripts/spotlight/user/browse_group_categories.js → javascript/spotlight/user/browse_group_categories.es6} +4 -13
- data/app/javascript/spotlight/user/carousel.es6 +5 -0
- data/app/{assets/javascripts/spotlight/user/clear_form_button.js → javascript/spotlight/user/clear_form_button.es6} +5 -9
- data/app/javascript/spotlight/user/index.js +17 -0
- data/app/{assets/javascripts/spotlight/user/report_a_problem.js → javascript/spotlight/user/report_a_problem.es6} +6 -15
- data/app/javascript/spotlight/user/zpr_links.es6 +44 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -2
- data/app/models/concerns/spotlight/browse_category_search_builder.rb +1 -10
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
- data/app/models/concerns/spotlight/resources/web.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/finder.rb +2 -2
- data/app/models/concerns/spotlight/solr_document.rb +2 -2
- data/app/models/concerns/spotlight/translatables.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/displayable.rb +2 -2
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +17 -6
- data/app/models/spotlight/analytics/ga.rb +5 -5
- data/app/models/spotlight/blacklight_configuration.rb +12 -12
- data/app/models/spotlight/bulk_update.rb +1 -0
- data/app/models/spotlight/contact_email.rb +1 -1
- data/app/models/spotlight/contact_form.rb +1 -1
- data/app/models/spotlight/exhibit.rb +1 -1
- data/app/models/spotlight/featured_image.rb +1 -2
- data/app/models/spotlight/lock.rb +1 -1
- data/app/models/spotlight/main_navigation.rb +1 -5
- data/app/models/spotlight/page.rb +1 -1
- data/app/models/spotlight/resources/iiif_manifest.rb +4 -4
- data/app/models/spotlight/resources/iiif_service.rb +1 -1
- data/app/models/spotlight/resources/upload.rb +3 -6
- data/app/models/spotlight/search.rb +2 -2
- data/app/models/translation.rb +2 -0
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -1
- data/app/services/spotlight/etl/solr_loader.rb +1 -1
- data/app/services/spotlight/iiif_resource_resolver.rb +10 -10
- data/app/uploaders/spotlight/bulk_updates_uploader.rb +1 -0
- data/app/views/layouts/spotlight/base.html.erb +1 -0
- data/app/views/shared/_exhibit_navbar.html.erb +6 -1
- data/app/views/spotlight/admin_users/index.html.erb +9 -3
- data/app/views/spotlight/browse/show.html.erb +2 -2
- data/app/views/spotlight/catalog/_admin_header.html.erb +3 -1
- data/app/views/spotlight/catalog/_document_visibility_control.html.erb +21 -2
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
- data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -1
- data/app/views/spotlight/exhibits/_contact.html.erb +5 -1
- data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +2 -0
- data/app/views/spotlight/shared/_report_a_problem.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
- data/app/views/spotlight/translations/_page.html.erb +6 -1
- data/config/locales/spotlight.en.yml +4 -9
- data/lib/generators/spotlight/install_generator.rb +15 -23
- data/lib/generators/spotlight/scaffold_resource_generator.rb +12 -12
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -0
- data/lib/generators/spotlight/templates/solr/conf/_rest_managed.json +3 -0
- data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -0
- data/lib/generators/spotlight/templates/solr/conf/elevate.xml +36 -0
- data/lib/generators/spotlight/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/lib/generators/spotlight/templates/solr/conf/protwords.txt +21 -0
- data/lib/generators/spotlight/templates/solr/{config → conf}/schema.xml +17 -0
- data/lib/generators/spotlight/templates/solr/conf/scripts.conf +24 -0
- data/lib/generators/spotlight/templates/solr/{config → conf}/solrconfig.xml +55 -24
- data/lib/generators/spotlight/templates/solr/conf/spellings.txt +2 -0
- data/lib/generators/spotlight/templates/solr/conf/stopwords.txt +58 -0
- data/lib/generators/spotlight/templates/solr/conf/stopwords_en.txt +58 -0
- data/lib/generators/spotlight/templates/solr/conf/synonyms.txt +31 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example.xsl +132 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example_atom.xsl +67 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example_rss.xsl +66 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/luke.xsl +337 -0
- data/lib/generators/spotlight/templates/spotlight.js +1 -1
- data/lib/migration/iiif.rb +3 -7
- data/lib/spotlight/engine.rb +18 -16
- data/lib/spotlight/riiif_service.rb +31 -0
- data/lib/spotlight/search_state.rb +19 -0
- data/lib/spotlight/upload_field_config.rb +1 -1
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +1 -1
- data/spec/factories/searches.rb +0 -12
- data/spec/fixtures/iiif_responses.rb +64 -64
- data/vendor/assets/javascripts/nestable.js +1 -1
- data/vendor/assets/javascripts/parameterize.js +2 -2
- data/vendor/assets/javascripts/sir-trevor.js +22460 -20591
- data/vendor/assets/stylesheets/sir-trevor/_icons.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/_variables.scss +16 -18
- data/vendor/assets/stylesheets/sir-trevor/base.scss +11 -0
- data/vendor/assets/stylesheets/sir-trevor/block-addition-top.scss +4 -1
- data/vendor/assets/stylesheets/sir-trevor/block-addition.scss +3 -2
- data/vendor/assets/stylesheets/sir-trevor/block-controls.scss +4 -0
- data/vendor/assets/stylesheets/sir-trevor/block-positioner.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/block-replacer.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/block-ui.scss +10 -0
- data/vendor/assets/stylesheets/sir-trevor/block.scss +19 -5
- data/vendor/assets/stylesheets/sir-trevor/errors.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/format-bar.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/inputs.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/main.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/patterns/ui-popup.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/utils.scss +0 -0
- metadata +118 -131
- data/app/assets/javascripts/spotlight/admin/add_another.js +0 -22
- data/app/assets/javascripts/spotlight/admin/add_new_button.js +0 -81
- data/app/assets/javascripts/spotlight/admin/appearance.js +0 -24
- data/app/assets/javascripts/spotlight/admin/attachments.js +0 -2
- data/app/assets/javascripts/spotlight/admin/blacklight_configuration.js +0 -63
- data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +0 -57
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +0 -87
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +0 -88
- data/app/assets/javascripts/spotlight/admin/blocks/oembed_block.js +0 -40
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +0 -145
- data/app/assets/javascripts/spotlight/admin/catalog_edit.js +0 -16
- data/app/assets/javascripts/spotlight/admin/copy_email_addresses.js +0 -9
- data/app/assets/javascripts/spotlight/admin/croppable.js +0 -25
- data/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +0 -37
- data/app/assets/javascripts/spotlight/admin/exhibits.js +0 -58
- data/app/assets/javascripts/spotlight/admin/index.js +0 -16
- data/app/assets/javascripts/spotlight/admin/locks.js +0 -12
- data/app/assets/javascripts/spotlight/admin/pages.js.erb +0 -40
- data/app/assets/javascripts/spotlight/admin/readonly_checkbox.js +0 -6
- data/app/assets/javascripts/spotlight/admin/tabs.js +0 -6
- data/app/assets/javascripts/spotlight/user/carousel.js +0 -3
- data/app/assets/javascripts/spotlight/user/index.js +0 -8
- data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +0 -45
- data/vendor/assets/javascripts/MutationObserver.js +0 -625
- data/vendor/assets/javascripts/eventable.js +0 -205
- data/vendor/assets/javascripts/polyfill.min.js +0 -4
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_embed_block.js +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_features_block.js +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_grid_block.js +0 -0
- /data/app/{assets/javascripts/spotlight/admin/iiif.es6 → javascript/spotlight/admin/iiif.js} +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/locales.js +0 -0
data/lib/spotlight/engine.rb
CHANGED
@@ -7,18 +7,19 @@ require 'devise'
|
|
7
7
|
require 'devise_invitable'
|
8
8
|
|
9
9
|
require 'activejob-status'
|
10
|
-
require 'blacklight'
|
11
10
|
require 'autoprefixer-rails'
|
12
|
-
require '
|
13
|
-
require 'tophat'
|
14
|
-
require 'paper_trail'
|
11
|
+
require 'blacklight'
|
15
12
|
require 'clipboard/rails'
|
16
|
-
require '
|
13
|
+
require 'faraday'
|
14
|
+
require 'faraday/follow_redirects'
|
15
|
+
require 'friendly_id'
|
17
16
|
require 'i18n/active_record'
|
18
|
-
require '
|
17
|
+
require 'leaflet-rails'
|
18
|
+
require 'paper_trail'
|
19
19
|
require 'riiif'
|
20
|
-
require '
|
21
|
-
require '
|
20
|
+
require 'spotlight/riiif_service'
|
21
|
+
require 'spotlight/upload_field_config'
|
22
|
+
require 'tophat'
|
22
23
|
|
23
24
|
module Spotlight
|
24
25
|
##
|
@@ -37,12 +38,10 @@ module Spotlight
|
|
37
38
|
end
|
38
39
|
|
39
40
|
require 'carrierwave'
|
40
|
-
require 'underscore-rails'
|
41
41
|
require 'redcarpet'
|
42
42
|
require 'github/markup'
|
43
43
|
require 'openseadragon'
|
44
44
|
require 'handlebars_assets'
|
45
|
-
require 'sprockets/es6'
|
46
45
|
|
47
46
|
config.assets.precompile += %w[spotlight/fallback/*.png]
|
48
47
|
|
@@ -67,11 +66,6 @@ module Spotlight
|
|
67
66
|
|
68
67
|
initializer 'spotlight.assets.precompile' do |app|
|
69
68
|
app.config.assets.precompile += %w[spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg]
|
70
|
-
|
71
|
-
Sprockets::ES6.configuration = { 'modules' => 'umd', 'moduleIds' => true }
|
72
|
-
# When we upgrade to Sprockets 4, we can ditch sprockets-es6 and config AMD
|
73
|
-
# in this way:
|
74
|
-
# https://github.com/rails/sprockets/issues/73#issuecomment-139113466
|
75
69
|
end
|
76
70
|
|
77
71
|
def self.user_class
|
@@ -114,6 +108,9 @@ module Spotlight
|
|
114
108
|
# The allowed file extensions for uploading non-repository items.
|
115
109
|
config.allowed_upload_extensions = %w[jpg jpeg png]
|
116
110
|
|
111
|
+
# IIIF integration
|
112
|
+
config.iiif_service = Spotlight::RiiifService
|
113
|
+
|
117
114
|
# Suffixes for spotlight-created solr fields
|
118
115
|
config.solr_fields = OpenStruct.new
|
119
116
|
config.solr_fields.prefix = ''
|
@@ -254,12 +251,17 @@ module Spotlight
|
|
254
251
|
|
255
252
|
config.spambot_honeypot_email_field = :email_address
|
256
253
|
|
257
|
-
|
254
|
+
config.to_prepare do
|
255
|
+
Blacklight::Configuration.try(:initialize_default_configuration) unless Blacklight::Configuration.try(:initialized_default_configuration?)
|
256
|
+
|
258
257
|
# Field containing the last modified date for a Solr document
|
259
258
|
Blacklight::Configuration.default_values[:index].timestamp_field ||= 'timestamp'
|
260
259
|
|
261
260
|
# Default configuration for the browse view
|
262
261
|
Blacklight::Configuration.default_values[:browse] ||= Blacklight::OpenStructWithHashAccess.new(document_actions: [])
|
262
|
+
|
263
|
+
Blacklight::Configuration.default_values[:search_state_fields] ||= []
|
264
|
+
Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id]
|
263
265
|
end
|
264
266
|
|
265
267
|
# make blacklight configuration play nice with bootstrap_form
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotlight
|
4
|
+
# iiif_service module for when using the built-in riiif server
|
5
|
+
module RiiifService
|
6
|
+
# @param [Spotlight::FeaturedImage] image
|
7
|
+
# @return [String]
|
8
|
+
def self.thumbnail_url(image)
|
9
|
+
Riiif::Engine.routes.url_helpers.image_path(image, size: '!400,400')
|
10
|
+
end
|
11
|
+
|
12
|
+
# @param [Spotlight::FeaturedImage] image
|
13
|
+
# @return [String]
|
14
|
+
def self.info_url(image, _host = nil)
|
15
|
+
Riiif::Engine.routes.url_helpers.info_path(image)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param [Spotlight::Exhibit] exhibit
|
19
|
+
# @param [Spotlight::FeaturedImage] image
|
20
|
+
# @return [String]
|
21
|
+
def self.manifest_url(exhibit, image)
|
22
|
+
Spotlight::Engine.routes.url_helpers.manifest_exhibit_solr_document_path(exhibit, "#{exhibit.id}-#{image.id}")
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [String] id
|
26
|
+
# @return [Hash]
|
27
|
+
def self.info(id)
|
28
|
+
Riiif::Image.new(id).info
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotlight
|
4
|
+
# Override Blacklight::SearchState to use exhibit-specific routes for documents
|
5
|
+
class SearchState < SimpleDelegator
|
6
|
+
attr_reader :current_exhibit
|
7
|
+
|
8
|
+
def initialize(search_state, current_exhibit)
|
9
|
+
super(search_state)
|
10
|
+
@current_exhibit = current_exhibit
|
11
|
+
end
|
12
|
+
|
13
|
+
def url_for_document(document, options = {})
|
14
|
+
return super unless current_exhibit
|
15
|
+
|
16
|
+
[controller.spotlight, current_exhibit, document]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -9,7 +9,7 @@ module Spotlight
|
|
9
9
|
class UploadFieldConfig
|
10
10
|
attr_reader :blacklight_options, :field_name, :form_field_type
|
11
11
|
|
12
|
-
def initialize(blacklight_options: {},
|
12
|
+
def initialize(field_name:, blacklight_options: {}, form_field_type: :text_field, label: nil, solr_fields: nil)
|
13
13
|
@blacklight_options = blacklight_options
|
14
14
|
@field_name = field_name
|
15
15
|
@form_field_type = form_field_type
|
data/lib/spotlight/version.rb
CHANGED
@@ -70,7 +70,7 @@ namespace :spotlight do
|
|
70
70
|
task :export, [:exhibit_slug] => :environment do |_, args|
|
71
71
|
exhibit = Spotlight::Exhibit.find_by(slug: args[:exhibit_slug])
|
72
72
|
|
73
|
-
puts Spotlight::
|
73
|
+
puts Spotlight::ExhibitImportExportService.new(exhibit).to_json
|
74
74
|
end
|
75
75
|
|
76
76
|
desc 'Migrate to IIIF'
|
data/spec/factories/searches.rb
CHANGED
@@ -30,16 +30,4 @@ FactoryBot.define do
|
|
30
30
|
|
31
31
|
after(:build) { |search| search.thumbnail = FactoryBot.create(:featured_image) }
|
32
32
|
end
|
33
|
-
|
34
|
-
factory :search_field_search, class: 'Spotlight::Search' do
|
35
|
-
exhibit
|
36
|
-
title { 'Based on a search field' }
|
37
|
-
query_params { { 'search_field' => 'search', 'q' => 'model' } }
|
38
|
-
end
|
39
|
-
|
40
|
-
factory :facet_search, class: 'Spotlight::Search' do
|
41
|
-
exhibit
|
42
|
-
title { 'Based on a facet' }
|
43
|
-
query_params { { 'f' => { 'language_ssim' => 'Latin' } } }
|
44
|
-
end
|
45
33
|
end
|
@@ -3,25 +3,25 @@
|
|
3
3
|
module IiifResponses
|
4
4
|
def complex_collection
|
5
5
|
{
|
6
|
-
|
7
|
-
|
6
|
+
'@id': 'uri://for-top-level-collection',
|
7
|
+
'@type': 'sc:Collection',
|
8
8
|
label: 'Complex Collection',
|
9
9
|
collections: [
|
10
10
|
{
|
11
|
-
|
12
|
-
|
11
|
+
'@id': 'uri://for-child-collection1',
|
12
|
+
'@type': 'sc:Collection',
|
13
13
|
label: 'Child Collection 1'
|
14
14
|
},
|
15
15
|
{
|
16
|
-
|
17
|
-
|
16
|
+
'@id': 'uri://for-child-collection2',
|
17
|
+
'@type': 'sc:Collection',
|
18
18
|
label: 'Child Collection 2'
|
19
19
|
}
|
20
20
|
],
|
21
21
|
manifests: [
|
22
22
|
{
|
23
|
-
|
24
|
-
|
23
|
+
'@id': 'uri://for-manifest1',
|
24
|
+
'@type': 'sc:Manifest',
|
25
25
|
label: 'Test Manifest 1'
|
26
26
|
}
|
27
27
|
]
|
@@ -30,20 +30,20 @@ module IiifResponses
|
|
30
30
|
|
31
31
|
def child_collection1
|
32
32
|
{
|
33
|
-
|
34
|
-
|
33
|
+
'@id': 'uri://for-child-collection1',
|
34
|
+
'@type': 'sc:Collection',
|
35
35
|
label: 'Child Collection 1',
|
36
36
|
collections: [
|
37
37
|
{
|
38
|
-
|
39
|
-
|
38
|
+
'@id': 'uri://for-child-collection3',
|
39
|
+
'@type': 'sc:Collection',
|
40
40
|
label: 'Child Collection 3'
|
41
41
|
}
|
42
42
|
],
|
43
43
|
manifests: [
|
44
44
|
{
|
45
|
-
|
46
|
-
|
45
|
+
'@id': 'uri://for-manifest2',
|
46
|
+
'@type': 'sc:Manifest',
|
47
47
|
label: 'Test Manifest 2'
|
48
48
|
}
|
49
49
|
]
|
@@ -52,13 +52,13 @@ module IiifResponses
|
|
52
52
|
|
53
53
|
def child_collection2
|
54
54
|
{
|
55
|
-
|
56
|
-
|
55
|
+
'@id': 'uri://for-child-collection2',
|
56
|
+
'@type': 'sc:Collection',
|
57
57
|
label: 'Child Collection 2',
|
58
58
|
manifests: [
|
59
59
|
{
|
60
|
-
|
61
|
-
|
60
|
+
'@id': 'uri://for-manifest4',
|
61
|
+
'@type': 'sc:Manifest',
|
62
62
|
label: 'Test Manifest 4'
|
63
63
|
}
|
64
64
|
]
|
@@ -67,13 +67,13 @@ module IiifResponses
|
|
67
67
|
|
68
68
|
def child_collection3
|
69
69
|
{
|
70
|
-
|
71
|
-
|
70
|
+
'@id': 'uri://for-child-collection3',
|
71
|
+
'@type': 'sc:Collection',
|
72
72
|
label: 'Child Collection 3',
|
73
73
|
manifests: [
|
74
74
|
{
|
75
|
-
|
76
|
-
|
75
|
+
'@id': 'uri://for-manifest3',
|
76
|
+
'@type': 'sc:Manifest',
|
77
77
|
label: 'Test Manifest 3'
|
78
78
|
}
|
79
79
|
]
|
@@ -82,8 +82,8 @@ module IiifResponses
|
|
82
82
|
|
83
83
|
def test_manifest1
|
84
84
|
{
|
85
|
-
|
86
|
-
|
85
|
+
'@id': 'uri://for-manifest1',
|
86
|
+
'@type': 'sc:Manifest',
|
87
87
|
label: 'Test Manifest 1',
|
88
88
|
attribution: 'Attribution Data',
|
89
89
|
description: 'A test IIIF manifest',
|
@@ -103,22 +103,22 @@ module IiifResponses
|
|
103
103
|
}
|
104
104
|
],
|
105
105
|
thumbnail: {
|
106
|
-
|
106
|
+
'@id': 'uri://to-thumbnail'
|
107
107
|
},
|
108
108
|
sequences: [
|
109
109
|
{
|
110
|
-
|
110
|
+
'@type': 'sc:Sequence',
|
111
111
|
canvases: [
|
112
112
|
{
|
113
|
-
|
113
|
+
'@type': 'sc:Canvas',
|
114
114
|
images: [
|
115
115
|
{
|
116
|
-
|
116
|
+
'@type': 'oa:Annotation',
|
117
117
|
resource: {
|
118
|
-
|
119
|
-
|
118
|
+
'@type': 'dcterms:Image',
|
119
|
+
'@id': 'uri://full-image',
|
120
120
|
service: {
|
121
|
-
|
121
|
+
'@id': 'uri://to-image-service'
|
122
122
|
}
|
123
123
|
}
|
124
124
|
}
|
@@ -132,11 +132,11 @@ module IiifResponses
|
|
132
132
|
|
133
133
|
def test_manifest2
|
134
134
|
{
|
135
|
-
|
136
|
-
|
135
|
+
'@id': 'uri://for-manifest2',
|
136
|
+
'@type': 'sc:Manifest',
|
137
137
|
label: {
|
138
|
-
|
139
|
-
|
138
|
+
'@value': 'Test Manifest 2',
|
139
|
+
'@language': 'en'
|
140
140
|
},
|
141
141
|
attribution: 'Attribution Data',
|
142
142
|
description: 'A test IIIF manifest',
|
@@ -152,30 +152,30 @@ module IiifResponses
|
|
152
152
|
}
|
153
153
|
],
|
154
154
|
thumbnail: {
|
155
|
-
|
155
|
+
'@id': 'uri://to-thumbnail'
|
156
156
|
},
|
157
157
|
sequences: [
|
158
158
|
{
|
159
|
-
|
159
|
+
'@type': 'sc:Sequence',
|
160
160
|
canvases: [
|
161
161
|
{
|
162
|
-
|
162
|
+
'@type': 'sc:Canvas',
|
163
163
|
images: [
|
164
164
|
{
|
165
|
-
|
165
|
+
'@type': 'oa:Annotation',
|
166
166
|
resource: {
|
167
|
-
|
167
|
+
'@type': 'dcterms:Image',
|
168
168
|
service: {
|
169
|
-
|
169
|
+
'@id': 'uri://to-image-service'
|
170
170
|
}
|
171
171
|
}
|
172
172
|
},
|
173
173
|
{
|
174
|
-
|
174
|
+
'@type': 'oa:Annotation',
|
175
175
|
resource: {
|
176
|
-
|
176
|
+
'@type': 'dcterms:Image',
|
177
177
|
service: {
|
178
|
-
|
178
|
+
'@id': 'uri://to-image-service2'
|
179
179
|
}
|
180
180
|
}
|
181
181
|
}
|
@@ -189,16 +189,16 @@ module IiifResponses
|
|
189
189
|
|
190
190
|
def test_manifest3
|
191
191
|
{
|
192
|
-
|
193
|
-
|
192
|
+
'@id': 'uri://for-manifest3',
|
193
|
+
'@type': 'sc:Manifest',
|
194
194
|
label: [
|
195
195
|
{
|
196
|
-
|
197
|
-
|
196
|
+
'@value': 'Test Manifest 3',
|
197
|
+
'@language': 'en'
|
198
198
|
},
|
199
199
|
{
|
200
|
-
|
201
|
-
|
200
|
+
'@value': "Manifeste d'essai 3",
|
201
|
+
'@language': 'fr'
|
202
202
|
}
|
203
203
|
],
|
204
204
|
attribution: 'Attribution Data',
|
@@ -215,21 +215,21 @@ module IiifResponses
|
|
215
215
|
}
|
216
216
|
],
|
217
217
|
thumbnail: {
|
218
|
-
|
218
|
+
'@id': 'uri://to-thumbnail'
|
219
219
|
},
|
220
220
|
sequences: [
|
221
221
|
{
|
222
|
-
|
222
|
+
'@type': 'sc:Sequence',
|
223
223
|
canvases: [
|
224
224
|
{
|
225
|
-
|
225
|
+
'@type': 'sc:Canvas',
|
226
226
|
images: [
|
227
227
|
{
|
228
|
-
|
228
|
+
'@type': 'oa:Annotation',
|
229
229
|
resource: {
|
230
|
-
|
230
|
+
'@type': 'dcterms:Image',
|
231
231
|
service: {
|
232
|
-
|
232
|
+
'@id': 'uri://to-image-service'
|
233
233
|
}
|
234
234
|
}
|
235
235
|
}
|
@@ -243,8 +243,8 @@ module IiifResponses
|
|
243
243
|
|
244
244
|
def test_manifest4
|
245
245
|
{
|
246
|
-
|
247
|
-
|
246
|
+
'@id': 'uri://for-manifest4',
|
247
|
+
'@type': 'sc:Manifest',
|
248
248
|
label: 'Test Manifest 4',
|
249
249
|
attribution: 'Attribution Data',
|
250
250
|
description: 'A test IIIF manifest',
|
@@ -260,21 +260,21 @@ module IiifResponses
|
|
260
260
|
}
|
261
261
|
],
|
262
262
|
thumbnail: {
|
263
|
-
|
263
|
+
'@id': 'uri://to-thumbnail'
|
264
264
|
},
|
265
265
|
sequences: [
|
266
266
|
{
|
267
|
-
|
267
|
+
'@type': 'sc:Sequence',
|
268
268
|
canvases: [
|
269
269
|
{
|
270
|
-
|
270
|
+
'@type': 'sc:Canvas',
|
271
271
|
images: [
|
272
272
|
{
|
273
|
-
|
273
|
+
'@type': 'oa:Annotation',
|
274
274
|
resource: {
|
275
|
-
|
275
|
+
'@type': 'dcterms:Image',
|
276
276
|
service: {
|
277
|
-
|
277
|
+
'@id': 'uri://to-image-service'
|
278
278
|
}
|
279
279
|
}
|
280
280
|
}
|
@@ -94,7 +94,7 @@ Downcoder.Initialize = function()
|
|
94
94
|
Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g') ;
|
95
95
|
}
|
96
96
|
|
97
|
-
|
97
|
+
const downcode = function( slug )
|
98
98
|
{
|
99
99
|
Downcoder.Initialize() ;
|
100
100
|
var downcoded =""
|
@@ -134,4 +134,4 @@ function URLify(s, num_chars) {
|
|
134
134
|
s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
|
135
135
|
s = s.toLowerCase(); // convert to lowercase
|
136
136
|
return s.substring(0, num_chars);// trim to first num_chars chars
|
137
|
-
}
|
137
|
+
}
|