blacklight-spotlight 3.0.0.rc4 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/blacklight/close.svg +1 -0
- data/app/assets/images/blacklight/zoom_in.svg +1 -0
- data/app/assets/images/blacklight/zoom_out.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +8 -1
- data/app/assets/javascripts/spotlight/admin/catalog_edit.js +13 -47
- data/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +37 -0
- data/app/assets/javascripts/spotlight/admin/{reindex_monitor.js → progress_monitor.js} +25 -4
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +1 -1
- data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +29 -14
- data/app/assets/stylesheets/spotlight/_browse.scss +8 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +30 -4
- data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +9 -0
- data/app/assets/stylesheets/spotlight/_modals.scss +3 -0
- data/app/assets/stylesheets/spotlight/_nestable.scss +8 -0
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/_view_larger.scss +22 -0
- data/app/assets/stylesheets/spotlight/typeahead.css +23 -23
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +4 -2
- data/app/controllers/concerns/spotlight/base.rb +1 -1
- data/app/controllers/concerns/spotlight/catalog.rb +7 -1
- data/app/controllers/spotlight/browse_controller.rb +9 -15
- data/app/controllers/spotlight/bulk_actions_controller.rb +62 -0
- data/app/controllers/spotlight/bulk_updates_controller.rb +67 -0
- data/app/controllers/spotlight/catalog_controller.rb +12 -12
- data/app/controllers/spotlight/dashboards_controller.rb +5 -4
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/job_trackers_controller.rb +17 -0
- data/app/controllers/spotlight/pages_controller.rb +6 -7
- data/app/controllers/spotlight/tags_controller.rb +39 -5
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/job_trackers_helper.rb +31 -0
- data/app/helpers/spotlight/main_app_helpers.rb +3 -4
- data/app/helpers/spotlight/meta_helper.rb +2 -2
- data/app/helpers/spotlight/pages_helper.rb +0 -7
- data/app/helpers/spotlight/roles_helper.rb +1 -1
- data/app/helpers/spotlight/searches_helper.rb +1 -1
- data/app/jobs/concerns/spotlight/gather_documents.rb +35 -0
- data/app/jobs/concerns/spotlight/job_tracking.rb +40 -23
- data/app/jobs/spotlight/add_tags_job.rb +31 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +2 -4
- data/app/jobs/spotlight/change_visibility_job.rb +33 -0
- data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +82 -0
- data/app/jobs/spotlight/reindex_exhibit_job.rb +5 -2
- data/app/jobs/spotlight/reindex_job.rb +35 -23
- data/app/jobs/spotlight/remove_tags_job.rb +31 -0
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +1 -0
- data/app/jobs/spotlight/rename_tags_job.rb +33 -0
- data/app/models/concerns/spotlight/browse_category_search_builder.rb +59 -0
- data/app/models/concerns/spotlight/exhibit_analytics.rb +2 -6
- 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/search_builder.rb +11 -0
- data/app/models/concerns/spotlight/solr_document.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +2 -2
- data/app/models/concerns/spotlight/user.rb +5 -1
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +9 -0
- data/app/models/sir_trevor_rails/blocks/uploaded_items_block.rb +4 -0
- data/app/models/spotlight/ability.rb +6 -2
- data/app/models/spotlight/attachment.rb +1 -1
- data/app/models/spotlight/{reindex_progress.rb → background_job_progress.rb} +8 -7
- data/app/models/spotlight/blacklight_configuration.rb +26 -6
- data/app/models/spotlight/bulk_update.rb +8 -0
- data/app/models/spotlight/exhibit.rb +2 -1
- data/app/models/spotlight/feature_page.rb +0 -2
- data/app/models/spotlight/featured_image.rb +40 -1
- data/app/models/spotlight/field_metadata.rb +4 -8
- data/app/models/spotlight/job_tracker.rb +11 -2
- data/app/models/spotlight/page.rb +1 -3
- data/app/models/spotlight/page_configurations.rb +10 -9
- data/app/models/spotlight/resource.rb +4 -4
- data/app/models/spotlight/resources/iiif_harvester.rb +2 -2
- data/app/models/spotlight/resources/iiif_service.rb +8 -1
- data/app/models/spotlight/resources/upload.rb +2 -2
- data/app/models/spotlight/role.rb +1 -2
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -2
- data/app/services/spotlight/bulk_updates_csv_template_service.rb +93 -0
- data/app/services/spotlight/etl/executor.rb +1 -3
- data/app/services/spotlight/iiif_resource_resolver.rb +1 -1
- data/app/uploaders/spotlight/bulk_updates_uploader.rb +7 -0
- data/app/uploaders/spotlight/featured_image_uploader.rb +1 -1
- data/app/views/catalog/_add_tags.html.erb +28 -0
- data/app/views/catalog/_bulk_actions.html.erb +12 -0
- data/app/views/catalog/_change_visibility.html.erb +35 -0
- data/app/views/catalog/_curator_actions.html.erb +3 -0
- data/app/views/catalog/_remove_tags.html.erb +37 -0
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/spotlight/about_pages/_sidebar.html.erb +2 -2
- data/app/views/spotlight/browse/_search.html.erb +3 -3
- data/app/views/spotlight/browse/_search_box.html.erb +9 -9
- data/app/views/spotlight/browse/_search_title.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_download.html.erb +23 -0
- data/app/views/spotlight/bulk_updates/_overview.html.erb +1 -0
- data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +19 -0
- data/app/views/spotlight/bulk_updates/_upload.html.erb +12 -0
- data/app/views/spotlight/bulk_updates/edit.html.erb +37 -0
- data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_thumbnail_default.html.erb +3 -2
- data/app/views/spotlight/catalog/_edit_default.html.erb +2 -2
- data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +1 -1
- data/app/views/spotlight/catalog/index.iiif_json.jbuilder +1 -1
- data/app/views/spotlight/custom_fields/_form.html.erb +1 -1
- data/app/views/spotlight/custom_search_fields/_form.html.erb +1 -1
- data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +1 -1
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_sidebar.html.erb +1 -1
- data/app/views/spotlight/featured_images/_form.html.erb +1 -1
- data/app/views/spotlight/job_trackers/show.html.erb +79 -0
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +2 -2
- data/app/views/spotlight/pages/_form.html.erb +2 -2
- data/app/views/spotlight/pages/_order_pages.html.erb +2 -2
- data/app/views/spotlight/pages/_view_type_group.html.erb +3 -3
- data/app/views/spotlight/pages/show.html.erb +1 -1
- data/app/views/spotlight/resources/_form.html.erb +1 -1
- data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
- data/app/views/spotlight/resources/iiif/_form.html.erb +1 -1
- data/app/views/spotlight/resources/json_upload/_form.html.erb +2 -2
- data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
- data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +2 -2
- data/app/views/spotlight/searches/_form.html.erb +2 -2
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +3 -0
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +8 -8
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +7 -7
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +9 -7
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +5 -5
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +4 -0
- data/app/views/spotlight/tags/_tag.html.erb +24 -0
- data/app/views/spotlight/tags/index.html.erb +12 -16
- data/app/views/spotlight/translations/show.yaml.yamlbuilder +6 -0
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/spotlight.en.yml +169 -10
- data/config/routes.rb +29 -1
- data/db/migrate/20210126123041_create_events.rb +1 -1
- data/db/migrate/20210305070001_remove_class_from_sirtrevor_image_blocks.rb +20 -0
- data/db/migrate/20210305171150_create_bulk_updates.rb +9 -0
- data/db/migrate/20210308090000_migrate_caption_values_for_title_key.rb +29 -0
- data/db/migrate/20210506070809_add_indexes_for_featured_images.rb +9 -0
- data/lib/generators/spotlight/install_generator.rb +2 -2
- data/lib/generators/spotlight/templates/config/initializers/riiif.rb +7 -5
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +1 -1
- data/lib/generators/spotlight/templates/solr/config/schema.xml +1 -1
- data/lib/migration/iiif.rb +3 -3
- data/lib/spotlight/engine.rb +14 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -6
- data/spec/controllers/spotlight/bulk_actions_controller_spec.rb +124 -0
- data/spec/controllers/spotlight/bulk_updates_controller_spec.rb +77 -0
- data/spec/controllers/spotlight/catalog_controller_spec.rb +12 -12
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/job_trackers_controller_spec.rb +37 -0
- data/spec/controllers/spotlight/tags_controller_spec.rb +5 -1
- data/spec/examples.txt +1496 -1442
- data/spec/factories/bulk_updates.rb +15 -0
- data/spec/factories/exhibits.rb +4 -0
- data/spec/factories/job_trackers.rb +2 -0
- data/spec/factories/users.rb +27 -8
- data/spec/features/add_items_spec.rb +1 -1
- data/spec/features/bulk_actions_spec.rb +72 -0
- data/spec/features/catalog_spec.rb +1 -0
- data/spec/features/import_exhibit_spec.rb +5 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +4 -4
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +27 -1
- data/spec/features/site_users_management_spec.rb +4 -4
- data/spec/fixtures/bulk-update-template.csv +57 -0
- data/spec/fixtures/updated-bulk-update-template-w-tags.csv +4 -0
- data/spec/fixtures/updated-bulk-update-template.csv +4 -0
- data/spec/helpers/spotlight/application_helper_spec.rb +5 -6
- data/spec/helpers/spotlight/pages_helper_spec.rb +0 -15
- data/spec/helpers/spotlight/roles_helper_spec.rb +1 -1
- data/spec/i18n_spec.rb +1 -0
- data/spec/jobs/spotlight/add_tags_job_spec.rb +34 -0
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +4 -1
- data/spec/jobs/spotlight/change_visibility_job_spec.rb +30 -0
- data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +78 -0
- data/spec/jobs/spotlight/reindex_job_spec.rb +4 -1
- data/spec/jobs/spotlight/remove_tags_job_spec.rb +39 -0
- data/spec/lib/migration/iiif_spec.rb +1 -1
- data/spec/models/spotlight/ability_spec.rb +27 -0
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -2
- data/spec/models/spotlight/{reindex_progress_spec.rb → background_job_progress_spec.rb} +15 -2
- data/spec/models/spotlight/blacklight_configuration_spec.rb +22 -17
- data/spec/models/spotlight/browse_category_search_builder_spec.rb +49 -0
- data/spec/models/spotlight/exhibit_spec.rb +1 -1
- data/spec/models/spotlight/featured_image_spec.rb +13 -1
- data/spec/models/spotlight/resource_spec.rb +23 -0
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +10 -0
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +1 -1
- data/spec/services/spotlight/bulk_updates_csv_template_service_spec.rb +26 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +2 -2
- data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/job_trackers/show.html.erb_spec.rb +65 -0
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -4
- data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +8 -4
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +7 -2
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +8 -5
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +3 -2
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +9 -4
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +5 -2
- metadata +90 -21
- data/app/assets/images/blacklight/add_circle.svg +0 -1
- data/app/assets/images/blacklight/custom_fullscreen.svg +0 -1
- data/app/assets/images/blacklight/remove_circle.svg +0 -1
- data/app/assets/images/blacklight/resize_small.svg +0 -1
data/config/routes.rb
CHANGED
@@ -99,6 +99,7 @@ Spotlight::Engine.routes.draw do
|
|
99
99
|
get :autocomplete
|
100
100
|
end
|
101
101
|
end
|
102
|
+
get 'browse/:browse_category_id', to: 'catalog#index', constraints: ->(req) { req.format != :html }
|
102
103
|
resources :browse, only: %i[index show]
|
103
104
|
get 'browse/group/:group_id', to: 'browse#index', as: 'browse_groups'
|
104
105
|
get 'browse/group/:group_id/:id', to: 'browse#show', as: 'browse_group'
|
@@ -109,7 +110,15 @@ Spotlight::Engine.routes.draw do
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
112
|
-
resources :tags, only: %i[index destroy]
|
113
|
+
resources :tags, only: %i[index destroy] do
|
114
|
+
collection do
|
115
|
+
patch :update_all
|
116
|
+
end
|
117
|
+
|
118
|
+
member do
|
119
|
+
post :rename
|
120
|
+
end
|
121
|
+
end
|
113
122
|
|
114
123
|
resources :contacts, only: %i[edit update destroy]
|
115
124
|
|
@@ -141,10 +150,29 @@ Spotlight::Engine.routes.draw do
|
|
141
150
|
get :clone
|
142
151
|
end
|
143
152
|
end
|
153
|
+
resource :bulk_actions, only: [] do
|
154
|
+
member do
|
155
|
+
post :change_visibility
|
156
|
+
post :add_tags
|
157
|
+
post :remove_tags
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
resource :bulk_updates, only: %i[edit update] do
|
162
|
+
collection do
|
163
|
+
get :monitor
|
164
|
+
end
|
165
|
+
|
166
|
+
member do
|
167
|
+
post :download_template
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
144
171
|
post '/pages/:id/preview' => 'pages#preview', as: :preview_block
|
145
172
|
get '/pages' => 'pages#index', constraints: { format: 'json' }
|
146
173
|
|
147
174
|
resources :lock, only: [:destroy]
|
175
|
+
resources :job_trackers, only: [:show]
|
148
176
|
|
149
177
|
resources :roles, path: 'users', only: %i[index create destroy] do
|
150
178
|
collection do
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class CreateEvents < ActiveRecord::Migration[5.2]
|
4
4
|
def change
|
5
5
|
create_table :spotlight_events do |t|
|
6
|
-
t.references :exhibit, null:
|
6
|
+
t.references :exhibit, null: true
|
7
7
|
t.references :resource, null: false, polymorphic: true, index: true
|
8
8
|
t.string :type
|
9
9
|
t.string :collation_key
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Remove the class field from the block; ostruct 0.3 helpfully allows it to override
|
4
|
+
# this field and that confuses sir trevor..
|
5
|
+
class RemoveClassFromSirtrevorImageBlocks < ActiveRecord::Migration[5.2]
|
6
|
+
def up
|
7
|
+
Spotlight::Page.reset_column_information
|
8
|
+
image = SirTrevorRails::Block.block_class('image')
|
9
|
+
|
10
|
+
Spotlight::Page.find_each do |page|
|
11
|
+
next unless page.content.any? { |block| block.is_a? image }
|
12
|
+
page.content.select { |block| block.is_a?(image) && block.respond_to?(:class=) }.each do |block|
|
13
|
+
block.delete_field(:class)
|
14
|
+
block.attachment = Spotlight::Attachment.find(block.id).to_global_id rescue nil
|
15
|
+
end
|
16
|
+
|
17
|
+
page.update(content: page.content)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Migrate caption fields for the document title (pointing at the solr field name) to use the
|
4
|
+
# new `Spotlight::PageConfigurations::DOCUMENT_TITLE_KEY` for run-time lookups instead.
|
5
|
+
class MigrateCaptionValuesForTitleKey < ActiveRecord::Migration[5.2]
|
6
|
+
def up
|
7
|
+
Spotlight::Page.reset_column_information
|
8
|
+
change_caption_field_of(Spotlight::Page, from: CatalogController.blacklight_config.index.title_field, to: Spotlight::PageConfigurations::DOCUMENT_TITLE_KEY)
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
Spotlight::Page.reset_column_information
|
13
|
+
change_caption_field_of(Spotlight::Page, from: Spotlight::PageConfigurations::DOCUMENT_TITLE_KEY, to: CatalogController.blacklight_config.index.title_field)
|
14
|
+
end
|
15
|
+
|
16
|
+
def change_caption_field_of(scope, from:, to:)
|
17
|
+
scope.find_each do |page|
|
18
|
+
changed = false
|
19
|
+
|
20
|
+
page.content.select { |block| block['primary-caption-field'] == from || block['secondary-caption-field'] == from }.each do |block|
|
21
|
+
changed = true
|
22
|
+
block['primary-caption-field'] = to if block['primary-caption-field'] == from
|
23
|
+
block['secondary-caption-field'] = to if block['secondary-caption-field'] == from
|
24
|
+
end
|
25
|
+
|
26
|
+
page.update(content: page.content) if changed
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddIndexesForFeaturedImages < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_index(:spotlight_searches, [:thumbnail_id])
|
4
|
+
add_index(:spotlight_searches, [:masthead_id])
|
5
|
+
add_index(:spotlight_exhibits, [:thumbnail_id])
|
6
|
+
add_index(:spotlight_exhibits, [:masthead_id])
|
7
|
+
add_index(:spotlight_pages, [:thumbnail_id])
|
8
|
+
end
|
9
|
+
end
|
@@ -113,10 +113,10 @@ module Spotlight
|
|
113
113
|
def add_search_builder_mixin
|
114
114
|
if File.exist? 'app/models/search_builder.rb'
|
115
115
|
inject_into_file 'app/models/search_builder.rb', after: "include Blacklight::Solr::SearchBuilderBehavior\n" do
|
116
|
-
"\n include Spotlight::
|
116
|
+
"\n include Spotlight::SearchBuilder\n"
|
117
117
|
end
|
118
118
|
else
|
119
|
-
say 'Unable to find SearchBuilder class; add `include Spotlight::
|
119
|
+
say 'Unable to find SearchBuilder class; add `include Spotlight::SearchBuilder` to the class manually.'
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
ActiveSupport::Reloader.to_prepare do
|
4
|
+
Riiif::Image.file_resolver = Spotlight::CarrierwaveFileResolver.new
|
4
5
|
|
5
|
-
# Riiif::Image.authorization_service = IIIFAuthorizationService
|
6
|
+
# Riiif::Image.authorization_service = IIIFAuthorizationService
|
6
7
|
|
7
|
-
# Riiif.not_found_image = 'app/assets/images/us_404.svg'
|
8
|
-
#
|
9
|
-
Riiif::Engine.config.cache_duration = 365.days
|
8
|
+
# Riiif.not_found_image = 'app/assets/images/us_404.svg'
|
9
|
+
#
|
10
|
+
Riiif::Engine.config.cache_duration = 365.days
|
11
|
+
end
|
@@ -73,7 +73,7 @@
|
|
73
73
|
# These are set by default by Spotlight's configuration,
|
74
74
|
# but you can customize them here, or in the SirTrevorRails::Block#custom_block_types method
|
75
75
|
# Spotlight::Engine.config.sir_trevor_widgets = %w(
|
76
|
-
# Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse BrowseGroupCategories
|
76
|
+
# Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse BrowseGroupCategories LinkToSearch
|
77
77
|
# FeaturedPages SolrDocuments SolrDocumentsCarousel SolrDocumentsEmbed
|
78
78
|
# SolrDocumentsFeatures SolrDocumentsGrid SearchResults
|
79
79
|
# )
|
@@ -306,7 +306,7 @@
|
|
306
306
|
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15" />
|
307
307
|
</analyzer>
|
308
308
|
|
309
|
-
<analyzer type="
|
309
|
+
<analyzer type="query">
|
310
310
|
<tokenizer class="solr.ICUTokenizerFactory"/>
|
311
311
|
<filter class="solr.ICUFoldingFilterFactory"/> <!-- NFKC, case folding, diacritics removed -->
|
312
312
|
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
data/lib/migration/iiif.rb
CHANGED
@@ -73,7 +73,7 @@ module Migration
|
|
73
73
|
|
74
74
|
old_file = File.new(filepath)
|
75
75
|
image = contact.create_avatar { |i| i.image.store!(old_file) }
|
76
|
-
iiif_tilesource = riiif.info_path(image
|
76
|
+
iiif_tilesource = riiif.info_path(image)
|
77
77
|
image.update(iiif_tilesource: iiif_tilesource, iiif_region: avatar_coordinates(contact))
|
78
78
|
image
|
79
79
|
end
|
@@ -87,7 +87,7 @@ module Migration
|
|
87
87
|
|
88
88
|
old_file = File.new(filepath)
|
89
89
|
image = upload.create_upload { |i| i.image.store!(old_file) }
|
90
|
-
iiif_tilesource = riiif.info_path(image
|
90
|
+
iiif_tilesource = riiif.info_path(image)
|
91
91
|
image.update(iiif_tilesource: iiif_tilesource)
|
92
92
|
upload.upload_id = image.id
|
93
93
|
upload.save_and_index
|
@@ -95,7 +95,7 @@ module Migration
|
|
95
95
|
|
96
96
|
def update_iiif_url(image)
|
97
97
|
image.update(
|
98
|
-
iiif_tilesource: riiif.info_url(image
|
98
|
+
iiif_tilesource: riiif.info_url(image, host: hostname),
|
99
99
|
iiif_region: coordinates(image)
|
100
100
|
)
|
101
101
|
end
|
data/lib/spotlight/engine.rb
CHANGED
@@ -17,6 +17,8 @@ require 'leaflet-rails'
|
|
17
17
|
require 'i18n/active_record'
|
18
18
|
require 'spotlight/upload_field_config'
|
19
19
|
require 'riiif'
|
20
|
+
require 'faraday'
|
21
|
+
require 'faraday_middleware'
|
20
22
|
|
21
23
|
module Spotlight
|
22
24
|
##
|
@@ -290,7 +292,19 @@ module Spotlight
|
|
290
292
|
|
291
293
|
config.reindexing_batch_size = nil
|
292
294
|
config.reindexing_batch_count = nil
|
295
|
+
config.hidden_job_classes = %w[Spotlight::ReindexJob]
|
296
|
+
|
297
|
+
config.bulk_actions_batch_size = 1000
|
298
|
+
|
299
|
+
config.bulk_updates = OpenStruct.new
|
300
|
+
config.bulk_updates.csv_id = 'Item ID'
|
301
|
+
config.bulk_updates.csv_title = 'Item Title'
|
302
|
+
config.bulk_updates.csv_visibility = 'Visibility'
|
303
|
+
config.bulk_updates.csv_tags_prefix = 'Tag:'
|
304
|
+
config.bulk_updates.csv_tags = 'Tag: %s'
|
293
305
|
|
294
306
|
config.assign_default_roles_to_first_user = true
|
307
|
+
|
308
|
+
config.exhibit_roles = %w[admin curator viewer]
|
295
309
|
end
|
296
310
|
end
|
data/lib/spotlight/version.rb
CHANGED
@@ -128,12 +128,6 @@ describe Spotlight::BrowseController, type: :controller do
|
|
128
128
|
get :show, params: { id: search, exhibit_id: exhibit }
|
129
129
|
expect(controller.blacklight_config.index.document_actions).to match_array %i[a b c]
|
130
130
|
end
|
131
|
-
|
132
|
-
it 'has a json response' do
|
133
|
-
get :show, params: { id: search, exhibit_id: exhibit, format: :json }
|
134
|
-
expect(assigns[:presenter]).to be_a Blacklight::JsonPresenter
|
135
|
-
expect(response).to render_template 'catalog/index'
|
136
|
-
end
|
137
131
|
end
|
138
132
|
end
|
139
133
|
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Spotlight::BulkActionsController, type: :controller do
|
4
|
+
routes { Spotlight::Engine.routes }
|
5
|
+
let(:exhibit) { FactoryBot.create(:skinny_exhibit) }
|
6
|
+
|
7
|
+
# rubocop:disable RSpec/BeforeAfterAll
|
8
|
+
before(:all) do
|
9
|
+
ActiveJob::Base.queue_adapter = :test
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:all) do
|
13
|
+
ActiveJob::Base.queue_adapter = :inline
|
14
|
+
end
|
15
|
+
# rubocop:enable RSpec/BeforeAfterAll
|
16
|
+
|
17
|
+
describe 'when the user is not authorized' do
|
18
|
+
before do
|
19
|
+
sign_in FactoryBot.create(:exhibit_visitor)
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'POST change_visibility' do
|
23
|
+
it 'denies access' do
|
24
|
+
post :change_visibility, params: { exhibit_id: exhibit }
|
25
|
+
expect(response).to redirect_to main_app.root_path
|
26
|
+
expect(flash[:alert]).to be_present
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'POST add_tags' do
|
31
|
+
it 'denies access' do
|
32
|
+
post :add_tags, params: { exhibit_id: exhibit }
|
33
|
+
expect(response).to redirect_to main_app.root_path
|
34
|
+
expect(flash[:alert]).to be_present
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'POST remove_tags' do
|
39
|
+
it 'denies access' do
|
40
|
+
post :remove_tags, params: { exhibit_id: exhibit }
|
41
|
+
expect(response).to redirect_to main_app.root_path
|
42
|
+
expect(flash[:alert]).to be_present
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'when the user is a curator' do
|
48
|
+
before do
|
49
|
+
sign_in FactoryBot.create(:exhibit_curator, exhibit: exhibit)
|
50
|
+
end
|
51
|
+
|
52
|
+
let(:search) { FactoryBot.create(:search, exhibit: exhibit) }
|
53
|
+
let(:search_session) { instance_double('Blacklight::Search', query_params: { q: 'map' }) }
|
54
|
+
|
55
|
+
describe 'POST change_visibility' do
|
56
|
+
it 'redirects and sets a notice' do
|
57
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
58
|
+
request.env['HTTP_REFERER'] = '/referring_url'
|
59
|
+
post :change_visibility, params: { 'visibility' => 'private', 'q' => 'map', exhibit_id: exhibit }
|
60
|
+
expect(response).to redirect_to '/referring_url'
|
61
|
+
expect(flash[:notice]).to eq 'Visibility of 55 items is being updated.'
|
62
|
+
end
|
63
|
+
|
64
|
+
# rubocop:disable Style/MultilineBlockChain
|
65
|
+
it 'enqueues the job' do
|
66
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
67
|
+
expect do
|
68
|
+
post :change_visibility, params: { 'visibility' => 'private', 'q' => 'map', exhibit_id: exhibit }
|
69
|
+
end.to have_enqueued_job(Spotlight::ChangeVisibilityJob).with do |solr_params, exhb, visibility|
|
70
|
+
expect(solr_params).to.not be_nil
|
71
|
+
expect(exhb).to eq exhibit
|
72
|
+
expect(visibility).to eq 'private'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
# rubocop:enable Style/MultilineBlockChain
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'POST add_tags' do
|
79
|
+
it 'redirects and sets a notice' do
|
80
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
81
|
+
request.env['HTTP_REFERER'] = '/referring_url'
|
82
|
+
post :add_tags, params: { 'tags' => 'howdy,planet', 'q' => 'map', exhibit_id: exhibit }
|
83
|
+
expect(response).to redirect_to '/referring_url'
|
84
|
+
expect(flash[:notice]).to eq 'Tags are being added for 55 items.'
|
85
|
+
end
|
86
|
+
|
87
|
+
# rubocop:disable Style/MultilineBlockChain
|
88
|
+
it 'enqueues the job' do
|
89
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
90
|
+
expect do
|
91
|
+
post :add_tags, params: { 'tags' => 'howdy,planet', 'q' => 'map', exhibit_id: exhibit }
|
92
|
+
end.to have_enqueued_job(Spotlight::AddTagsJob).with do |solr_params, exhb, tags|
|
93
|
+
expect(solr_params).to.not be_nil
|
94
|
+
expect(exhb).to eq exhibit
|
95
|
+
expect(tags).to eq %w[howdy planet]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
# rubocop:enable Style/MultilineBlockChain
|
99
|
+
end
|
100
|
+
|
101
|
+
describe 'POST remove_tags' do
|
102
|
+
it 'redirects and sets a notice' do
|
103
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
104
|
+
request.env['HTTP_REFERER'] = '/referring_url'
|
105
|
+
post :remove_tags, params: { 'tags' => 'hello,world', 'q' => 'map', exhibit_id: exhibit }
|
106
|
+
expect(response).to redirect_to '/referring_url'
|
107
|
+
expect(flash[:notice]).to eq 'Tags are being removed for 55 items.'
|
108
|
+
end
|
109
|
+
|
110
|
+
# rubocop:disable Style/MultilineBlockChain
|
111
|
+
it 'enqueues the job' do
|
112
|
+
allow(controller).to receive(:current_search_session).and_return(search_session)
|
113
|
+
expect do
|
114
|
+
post :remove_tags, params: { 'tags' => 'howdy,planet', 'q' => 'map', exhibit_id: exhibit }
|
115
|
+
end.to have_enqueued_job(Spotlight::RemoveTagsJob).with do |solr_params, exhb, tags|
|
116
|
+
expect(solr_params).to.not be_nil
|
117
|
+
expect(exhb).to eq exhibit
|
118
|
+
expect(tags).to eq %w[howdy planet]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
# rubocop:enable Style/MultilineBlockChain
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Spotlight::BulkUpdatesController, type: :controller do
|
4
|
+
routes { Spotlight::Engine.routes }
|
5
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
+
|
7
|
+
describe 'when the user is not authorized' do
|
8
|
+
before do
|
9
|
+
sign_in FactoryBot.create(:exhibit_visitor)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'GET edit' do
|
13
|
+
it 'denies access' do
|
14
|
+
get :edit, params: { exhibit_id: exhibit }
|
15
|
+
expect(response).to redirect_to main_app.root_path
|
16
|
+
expect(flash[:alert]).to be_present
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'POST download_template' do
|
21
|
+
it 'denies access' do
|
22
|
+
post :download_template, params: { exhibit_id: exhibit }
|
23
|
+
expect(response).to redirect_to main_app.root_path
|
24
|
+
expect(flash[:alert]).to be_present
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'when the user is a curator' do
|
30
|
+
before do
|
31
|
+
sign_in FactoryBot.create(:exhibit_curator, exhibit: exhibit)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'GET edit' do
|
35
|
+
it 'is allowed' do
|
36
|
+
get :edit, params: { exhibit_id: exhibit }
|
37
|
+
expect(response).to be_successful
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'POST download_template' do
|
42
|
+
it 'downloads a CSV template' do
|
43
|
+
post :download_template, params: {
|
44
|
+
exhibit_id: exhibit,
|
45
|
+
reference_fields: { item_id: 1, item_title: 1 },
|
46
|
+
updatable_fields: { tags: 0, visibility: 1 }
|
47
|
+
}
|
48
|
+
|
49
|
+
content = CSV.parse(response.body)
|
50
|
+
expect(content.length).to eq 56
|
51
|
+
expect(content[0]).to eq ['Item ID', 'Item Title', 'Visibility']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'PATCH download_template' do
|
56
|
+
before { ActiveJob::Base.queue_adapter = :test }
|
57
|
+
|
58
|
+
after { ActiveJob::Base.queue_adapter = :inline }
|
59
|
+
|
60
|
+
it 'uploads the given CSV template and passes it to a job' do
|
61
|
+
expect do
|
62
|
+
patch :update, params: {
|
63
|
+
exhibit_id: exhibit,
|
64
|
+
file: fixture_file_upload('spec/fixtures/bulk-update-template.csv', 'text/csv')
|
65
|
+
}
|
66
|
+
end.to(have_enqueued_job(Spotlight::ProcessBulkUpdatesCsvJob).with do |job_exhibit, uploader|
|
67
|
+
expect(job_exhibit).to eq exhibit
|
68
|
+
expect(uploader).to be_a Spotlight::BulkUpdate
|
69
|
+
expect(uploader.file_identifier).to eq 'bulk-update-template.csv'
|
70
|
+
end)
|
71
|
+
|
72
|
+
expect(flash[:notice]).to eq 'The CSV file was uploaded successfully.'
|
73
|
+
expect(response).to redirect_to(spotlight.edit_exhibit_bulk_updates_path(exhibit))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|