blacklight-spotlight 3.0.0.alpha.9 → 3.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
- data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
- data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +55 -1
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -2
- data/app/assets/javascripts/spotlight/admin/crop.es6 +11 -0
- data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
- data/app/assets/javascripts/spotlight/admin/index.js +0 -2
- data/app/assets/javascripts/spotlight/admin/reindex_monitor.js +1 -0
- data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
- data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +21 -12
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +11 -3
- data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
- data/app/assets/javascripts/spotlight/user/index.js +1 -0
- data/app/assets/stylesheets/spotlight/_accessibility.scss +1 -1
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
- data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +6 -6
- data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +214 -83
- data/app/assets/stylesheets/spotlight/_header.scss +1 -1
- data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
- data/app/assets/stylesheets/spotlight/_pages.scss +9 -4
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/_translations.scss +7 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +92 -0
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
- data/app/controllers/spotlight/appearances_controller.rb +0 -12
- data/app/controllers/spotlight/browse_controller.rb +7 -3
- data/app/controllers/spotlight/catalog_controller.rb +5 -2
- data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
- data/app/controllers/spotlight/dashboards_controller.rb +1 -1
- data/app/controllers/spotlight/exhibits_controller.rb +2 -3
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/groups_controller.rb +80 -0
- data/app/controllers/spotlight/pages_controller.rb +6 -9
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +7 -19
- data/app/controllers/spotlight/translations_controller.rb +46 -0
- data/app/helpers/spotlight/application_helper.rb +20 -1
- data/app/helpers/spotlight/crop_helper.rb +4 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/jobs/concerns/spotlight/job_tracking.rb +47 -0
- data/app/jobs/concerns/spotlight/limit_concurrency.rb +33 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +34 -6
- data/app/jobs/spotlight/application_job.rb +8 -0
- data/app/jobs/spotlight/cleanup_job_trackers_job.rb +13 -0
- data/app/jobs/spotlight/default_thumbnail_job.rb +1 -3
- data/app/jobs/spotlight/reindex_exhibit_job.rb +36 -0
- data/app/jobs/spotlight/reindex_job.rb +49 -41
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +2 -2
- data/app/jobs/spotlight/update_job_trackers_job.rb +20 -0
- data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/translatables.rb +17 -1
- data/app/models/concerns/spotlight/user.rb +2 -1
- data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
- data/app/models/spotlight/ability.rb +2 -0
- data/app/models/spotlight/about_page.rb +3 -1
- data/app/models/spotlight/blacklight_configuration.rb +2 -1
- data/app/models/spotlight/contact.rb +1 -1
- data/app/models/spotlight/custom_field.rb +3 -3
- data/app/models/spotlight/event.rb +13 -0
- data/app/models/spotlight/exhibit.rb +18 -14
- data/app/models/spotlight/feature_page.rb +3 -1
- data/app/models/spotlight/featured_image.rb +29 -12
- data/app/models/spotlight/group.rb +22 -0
- data/app/models/spotlight/group_member.rb +11 -0
- data/app/models/spotlight/home_page.rb +3 -1
- data/app/models/spotlight/job_tracker.rb +105 -0
- data/app/models/spotlight/main_navigation.rb +2 -2
- data/app/models/spotlight/masthead.rb +1 -1
- data/app/models/spotlight/page.rb +5 -1
- data/app/models/spotlight/page_configurations.rb +6 -0
- data/app/models/spotlight/page_content.rb +2 -0
- data/app/models/spotlight/reindex_progress.rb +44 -27
- data/app/models/spotlight/resource.rb +24 -58
- data/app/models/spotlight/resources/csv_upload.rb +2 -1
- data/app/models/spotlight/resources/iiif_harvester.rb +10 -1
- data/app/models/spotlight/resources/iiif_manifest.rb +11 -7
- data/app/models/spotlight/resources/iiif_service.rb +1 -1
- data/app/models/spotlight/resources/json_upload.rb +12 -0
- data/app/models/spotlight/resources/upload.rb +25 -2
- data/app/models/spotlight/search.rb +10 -1
- data/app/models/spotlight/solr_document_sidecar.rb +9 -6
- data/app/models/spotlight/temporary_image.rb +8 -0
- data/app/services/spotlight/etl.rb +7 -0
- data/app/services/spotlight/etl/context.rb +52 -0
- data/app/services/spotlight/etl/executor.rb +194 -0
- data/app/services/spotlight/etl/loaders.rb +12 -0
- data/app/services/spotlight/etl/pipeline.rb +81 -0
- data/app/services/spotlight/etl/solr_loader.rb +96 -0
- data/app/services/spotlight/etl/sources.rb +25 -0
- data/app/services/spotlight/etl/step.rb +82 -0
- data/app/services/spotlight/etl/transforms.rb +64 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +482 -0
- data/app/services/spotlight/validity_checker.rb +5 -5
- data/app/values/custom_field_name.rb +1 -0
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/spotlight/about_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/browse/_search.html.erb +5 -3
- data/app/views/spotlight/browse/_search_title.html.erb +2 -1
- data/app/views/spotlight/browse/index.html.erb +13 -0
- data/app/views/spotlight/catalog/_document.html.erb +2 -4
- data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
- data/app/views/spotlight/contacts/_form.html.erb +1 -1
- data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +6 -6
- data/app/views/spotlight/feature_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/featured_images/_form.html.erb +1 -1
- data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
- data/app/views/spotlight/home_pages/_empty.html.erb +3 -3
- data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
- data/app/views/spotlight/pages/_form.html.erb +2 -2
- data/app/views/spotlight/searches/_form.html.erb +13 -0
- data/app/views/spotlight/searches/_group.html.erb +27 -0
- data/app/views/spotlight/searches/_search.html.erb +1 -0
- data/app/views/spotlight/searches/index.html.erb +58 -17
- data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
- data/app/views/spotlight/shared/_locale_picker.html.erb +1 -1
- data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +45 -0
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
- data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
- data/app/views/spotlight/translations/_general.html.erb +7 -7
- data/app/views/spotlight/translations/_groups.html.erb +34 -0
- data/app/views/spotlight/translations/_import.html.erb +24 -0
- data/app/views/spotlight/translations/_metadata.html.erb +1 -1
- data/app/views/spotlight/translations/_page.html.erb +5 -5
- data/app/views/spotlight/translations/_pages.html.erb +4 -4
- data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
- data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
- data/app/views/spotlight/translations/edit.html.erb +14 -6
- data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
- data/config/i18n-tasks.yml +7 -0
- data/config/locales/spotlight.ar.yml +57 -24
- data/config/locales/spotlight.en.yml +184 -128
- data/config/routes.rb +16 -1
- data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
- data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
- data/db/migrate/20210122082032_create_job_trackers.rb +22 -0
- data/db/migrate/20210126123041_create_events.rb +15 -0
- data/lib/generators/spotlight/install_generator.rb +23 -2
- data/lib/generators/spotlight/scaffold_resource_generator.rb +5 -13
- data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -1
- data/lib/spotlight/engine.rb +35 -4
- data/lib/spotlight/upload_field_config.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/browse_controller_spec.rb +24 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +4 -2
- data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
- data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
- data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +1448 -125
- data/spec/factories/featured_images.rb +4 -0
- data/spec/factories/group.rb +17 -0
- data/spec/factories/job_trackers.rb +9 -0
- data/spec/factories/searches.rb +11 -1
- data/spec/features/add_contacts_spec.rb +1 -1
- data/spec/features/add_items_spec.rb +9 -4
- data/spec/features/browse_category_admin_spec.rb +39 -7
- data/spec/features/browse_category_navigation_spec.rb +44 -0
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/catalog_spec.rb +2 -2
- data/spec/features/create_exhibit_spec.rb +5 -4
- data/spec/features/dashboard_spec.rb +7 -7
- data/spec/features/edit_search_fields_spec.rb +2 -2
- data/spec/features/exhibits/administration_spec.rb +3 -3
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
- data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
- data/spec/features/exhibits/translation_editing_spec.rb +57 -8
- data/spec/features/home_page_spec.rb +13 -4
- data/spec/features/item_admin_spec.rb +4 -4
- data/spec/features/javascript/about_page_admin_spec.rb +1 -1
- data/spec/features/javascript/block_controls_spec.rb +3 -1
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
- data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
- data/spec/features/javascript/edit_in_place_spec.rb +3 -3
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/features/javascript/reindex_monitor_spec.rb +1 -1
- data/spec/features/javascript/search_config_admin_spec.rb +1 -1
- data/spec/features/report_a_problem_spec.rb +6 -5
- data/spec/features/site_users_management_spec.rb +4 -4
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
- data/spec/helpers/spotlight/pages_helper_spec.rb +10 -2
- data/spec/i18n_spec.rb +0 -2
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
- data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +43 -0
- data/spec/jobs/spotlight/reindex_job_spec.rb +30 -59
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
- data/spec/models/solr_document_spec.rb +2 -3
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
- data/spec/models/spotlight/exhibit_spec.rb +21 -59
- data/spec/models/spotlight/featured_image_spec.rb +27 -0
- data/spec/models/spotlight/group_spec.rb +19 -0
- data/spec/models/spotlight/main_navigation_spec.rb +1 -1
- data/spec/models/spotlight/page_spec.rb +6 -1
- data/spec/models/spotlight/reindex_progress_spec.rb +89 -87
- data/spec/models/spotlight/resource_spec.rb +69 -90
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +9 -10
- data/spec/models/spotlight/resources/upload_spec.rb +43 -79
- data/spec/models/spotlight/role_spec.rb +3 -3
- data/spec/models/spotlight/search_spec.rb +30 -3
- data/spec/models/spotlight/solr_document_sidecar_spec.rb +1 -0
- data/spec/services/spotlight/etl/context_spec.rb +66 -0
- data/spec/services/spotlight/etl/executor_spec.rb +149 -0
- data/spec/services/spotlight/etl/pipeline_spec.rb +22 -0
- data/spec/services/spotlight/etl/solr_loader_spec.rb +76 -0
- data/spec/services/spotlight/etl/step_spec.rb +70 -0
- data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +168 -23
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -6
- data/spec/support/features/test_features_helpers.rb +15 -0
- data/spec/test_app_templates/Gemfile.extra +1 -3
- data/spec/test_app_templates/catalog_controller.rb +6 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +28 -25
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
- data/vendor/assets/javascripts/tiny-slider.js +3218 -0
- data/vendor/assets/stylesheets/tiny-slider.css +1 -0
- metadata +444 -289
- data/app/models/concerns/spotlight/resources/open_graph.rb +0 -36
- data/app/models/spotlight/reindexing_log_entry.rb +0 -42
- data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
- data/app/serializers/spotlight/featured_image_representer.rb +0 -29
- data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
- data/app/serializers/spotlight/page_representer.rb +0 -33
- data/app/services/spotlight/resources/iiif_builder.rb +0 -19
- data/app/services/spotlight/solr_document_builder.rb +0 -76
- data/app/services/spotlight/upload_solr_document_builder.rb +0 -57
- data/spec/factories/reindexing_log_entries.rb +0 -54
- data/spec/models/spotlight/reindexing_log_entry_spec.rb +0 -129
- data/spec/models/spotlight/resources/open_graph_spec.rb +0 -65
- data/spec/services/spotlight/solr_document_builder_spec.rb +0 -66
- data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -68,7 +68,7 @@ describe Spotlight::IiifResourceResolver do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
context 'when the stored
|
71
|
+
context 'when the stored image ID is not present' do
|
72
72
|
it 'raises a ManifestError' do
|
73
73
|
resource.iiif_image_id = 'not-a-real-image-id'
|
74
74
|
|
data/spec/spec_helper.rb
CHANGED
@@ -48,6 +48,8 @@ require 'spotlight'
|
|
48
48
|
|
49
49
|
# configure spotlight with all the settings necessary to test functionality
|
50
50
|
Spotlight::Engine.config.exhibit_themes = %w[default modern]
|
51
|
+
Spotlight::Engine.config.reindexing_batch_count = 1
|
52
|
+
Spotlight::Engine.config.assign_default_roles_to_first_user = false
|
51
53
|
|
52
54
|
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
53
55
|
|
@@ -62,11 +64,6 @@ RSpec.configure do |config|
|
|
62
64
|
|
63
65
|
config.use_transactional_fixtures = true
|
64
66
|
|
65
|
-
config.before do
|
66
|
-
# The first user is automatically granted admin privileges; we don't want that behavior for many of our tests
|
67
|
-
Spotlight::Engine.user_class.create email: 'initial+admin@example.com', password: 'password', password_confirmation: 'password'
|
68
|
-
end
|
69
|
-
|
70
67
|
if defined? Devise::Test::ControllerHelpers
|
71
68
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
72
69
|
config.include Devise::Test::ControllerHelpers, type: :view
|
@@ -136,7 +133,7 @@ RSpec.configure do |config|
|
|
136
133
|
Kernel.srand config.seed
|
137
134
|
end
|
138
135
|
|
139
|
-
def
|
136
|
+
def add_new_via_button(title = 'New Page')
|
140
137
|
add_link = find('[data-expanded-add-button]')
|
141
138
|
within(add_link) do
|
142
139
|
expect(page).to have_css("input[type='text']", visible: false)
|
@@ -15,6 +15,21 @@ module Spotlight
|
|
15
15
|
find('.tt-suggestion', text: opts[:with], match: :first).click
|
16
16
|
end
|
17
17
|
|
18
|
+
##
|
19
|
+
# For typeahead "prefetched" fields, we need to wait for a resolved selector
|
20
|
+
# before proceeding.
|
21
|
+
def fill_in_prefetched_typeahead_field(opts)
|
22
|
+
type = opts[:type] || 'twitter'
|
23
|
+
# Poltergeist / Capybara doesn't fire the events typeahead.js
|
24
|
+
# is listening for, so we help it out a little:
|
25
|
+
find(opts[:wait_for]) if opts[:wait_for]
|
26
|
+
page.execute_script <<-EOF
|
27
|
+
$("[data-#{type}-typeahead]:visible").val("#{opts[:with]}").trigger("input");
|
28
|
+
$("[data-#{type}-typeahead]:visible").typeahead("open");
|
29
|
+
$(".tt-suggestion").click();
|
30
|
+
EOF
|
31
|
+
end
|
32
|
+
|
18
33
|
# just like #fill_in_typeahead_field, but wait for the
|
19
34
|
# form fields to show up on the page too
|
20
35
|
def fill_in_solr_document_block_typeahead_field(opts)
|
@@ -6,6 +6,12 @@ class CatalogController < ApplicationController
|
|
6
6
|
before_action :set_paper_trail_whodunnit
|
7
7
|
|
8
8
|
configure_blacklight do |config|
|
9
|
+
config.view.gallery.document_component = Blacklight::Gallery::DocumentComponent
|
10
|
+
# config.view.gallery.classes = 'row-cols-2 row-cols-md-3'
|
11
|
+
config.view.masonry.document_component = Blacklight::Gallery::DocumentComponent
|
12
|
+
config.view.slideshow.document_component = Blacklight::Gallery::SlideshowComponent
|
13
|
+
config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
|
14
|
+
config.show.partials.insert(1, :openseadragon)
|
9
15
|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
10
16
|
config.default_solr_params = {
|
11
17
|
qt: 'search',
|
@@ -29,9 +35,6 @@ class CatalogController < ApplicationController
|
|
29
35
|
config.index.display_type_field = 'content_metadata_type_ssm'
|
30
36
|
config.index.thumbnail_field = Spotlight::Engine.config.thumbnail_field
|
31
37
|
|
32
|
-
config.view.gallery.partials = %i[index_header index]
|
33
|
-
config.view.slideshow.partials = [:index]
|
34
|
-
|
35
38
|
config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
|
36
39
|
config.show.partials.insert(1, :openseadragon)
|
37
40
|
|
@@ -42,7 +42,7 @@ describe 'shared/_exhibit_navbar', type: :view do
|
|
42
42
|
feature_page
|
43
43
|
another_page = FactoryBot.create(:feature_page, exhibit: current_exhibit)
|
44
44
|
render
|
45
|
-
expect(response).to have_selector '.dropdown .dropdown-toggle', text: 'Curated
|
45
|
+
expect(response).to have_selector '.dropdown .dropdown-toggle', text: 'Curated features'
|
46
46
|
expect(response).to have_link feature_page.title, visible: false, href: spotlight.exhibit_feature_page_path(current_exhibit, feature_page)
|
47
47
|
expect(response).to have_link another_page.title, visible: false, href: spotlight.exhibit_feature_page_path(current_exhibit, another_page)
|
48
48
|
end
|
@@ -7,11 +7,13 @@ describe 'spotlight/browse/index', type: :view do
|
|
7
7
|
before { allow(view).to receive(:current_exhibit).and_return(search.exhibit) }
|
8
8
|
|
9
9
|
it 'has a title' do
|
10
|
+
assign :groups, []
|
10
11
|
render
|
11
12
|
expect(response).to have_selector 'h1', text: 'Browse'
|
12
13
|
end
|
13
14
|
|
14
15
|
it 'renders the collection of searches' do
|
16
|
+
assign :groups, []
|
15
17
|
assign :searches, [search, another_search]
|
16
18
|
stub_template 'spotlight/browse/_search.html.erb' => '<%= search.id %> <br/>'
|
17
19
|
render
|
@@ -19,7 +19,7 @@ describe 'spotlight/dashboards/_analytics.html.erb', type: :view do
|
|
19
19
|
|
20
20
|
it 'has header' do
|
21
21
|
render
|
22
|
-
expect(rendered).to have_content 'User
|
22
|
+
expect(rendered).to have_content 'User activity over the past month'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'has metric labels' do
|
@@ -1,26 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'spotlight/dashboards/_reindexing_activity.html.erb', type: :view do
|
4
|
-
# recent reindexing entries should be sorted by start_time in descending order, so mock that behavior
|
5
|
-
let(:recent_reindexing) do
|
6
|
-
[FactoryBot.build(:unstarted_reindexing_log_entry)] + # nil start_time is trouble for the sort_by used to create the rest of the fixture's rows
|
7
|
-
[
|
8
|
-
FactoryBot.build(:reindexing_log_entry),
|
9
|
-
FactoryBot.build(:in_progress_reindexing_log_entry),
|
10
|
-
FactoryBot.build(:recent_reindexing_log_entry),
|
11
|
-
FactoryBot.build(:failed_reindexing_log_entry)
|
12
|
-
].sort_by(&:start_time).reverse
|
13
|
-
end
|
14
4
|
let(:p) { 'spotlight/dashboards/reindexing_activity' }
|
15
5
|
|
6
|
+
before do
|
7
|
+
assign(:recent_reindexing, recent_reindexing)
|
8
|
+
end
|
9
|
+
|
16
10
|
context 'the reindexing log is empty' do
|
11
|
+
let(:recent_reindexing) { [] }
|
12
|
+
|
17
13
|
before do
|
18
|
-
assign(:recent_reindexing, [])
|
19
14
|
render p
|
20
15
|
end
|
21
16
|
|
22
17
|
it 'displays the section header' do
|
23
|
-
expect(rendered).to have_css('h2', text: 'Recent
|
18
|
+
expect(rendered).to have_css('h2', text: 'Recent item indexing activity')
|
24
19
|
end
|
25
20
|
|
26
21
|
it 'displays an explanatory message when there are no reindexing attempts in the log' do
|
@@ -29,21 +24,31 @@ describe 'spotlight/dashboards/_reindexing_activity.html.erb', type: :view do
|
|
29
24
|
end
|
30
25
|
|
31
26
|
context 'the reindexing log has entries' do
|
27
|
+
# recent reindexing entries should be sorted by start_time in descending order, so mock that behavior
|
28
|
+
let(:recent_reindexing) do
|
29
|
+
[
|
30
|
+
FactoryBot.build(:job_tracker, status: 'enqueued'),
|
31
|
+
FactoryBot.build(:job_tracker, status: 'completed', data: { progress: 10 }),
|
32
|
+
FactoryBot.build(:job_tracker, status: 'in_progress', created_at: Time.zone.parse('January 10, 2017 23:00')),
|
33
|
+
FactoryBot.build(:job_tracker, status: 'completed', data: { progress: 100 }),
|
34
|
+
FactoryBot.build(:job_tracker, status: 'failed', data: { progress: 10 })
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
32
38
|
before do
|
33
|
-
assign(:recent_reindexing, recent_reindexing)
|
34
39
|
render p
|
35
40
|
end
|
36
41
|
|
37
42
|
it 'displays the correct localized column headings when there are reindexing attempts in the log' do
|
38
43
|
expect(rendered).to have_css('table.table-striped th.col-3', text: 'Date', count: 1)
|
39
|
-
expect(rendered).to have_css('table.table-striped th.col-3', text: 'Requested
|
40
|
-
expect(rendered).to have_css('table.table-striped th.col-1', text: 'Items
|
41
|
-
expect(rendered).to have_css('table.table-striped th.col-3', text: 'Elapsed
|
44
|
+
expect(rendered).to have_css('table.table-striped th.col-3', text: 'Requested by', count: 1)
|
45
|
+
expect(rendered).to have_css('table.table-striped th.col-1', text: 'Items indexed', count: 1)
|
46
|
+
expect(rendered).to have_css('table.table-striped th.col-3', text: 'Elapsed time', count: 1)
|
42
47
|
expect(rendered).to have_css('table.table-striped th.col-2', text: 'Status', count: 1)
|
43
48
|
end
|
44
49
|
|
45
50
|
it 'formats the start time correctly' do
|
46
|
-
expect(rendered).to have_css('table.table-striped td', text: 'January 05, 2017 23:00', count:
|
51
|
+
expect(rendered).to have_css('table.table-striped td', text: 'January 05, 2017 23:00', count: 4)
|
47
52
|
expect(rendered).to have_css('table.table-striped td', text: 'January 10, 2017 23:00', count: 1)
|
48
53
|
end
|
49
54
|
|
@@ -60,22 +65,20 @@ describe 'spotlight/dashboards/_reindexing_activity.html.erb', type: :view do
|
|
60
65
|
expect(rendered).to have_css('table.table-striped td', text: '5 minutes', count: 3)
|
61
66
|
end
|
62
67
|
|
63
|
-
it 'displays nothing in the duration column or start time column when the info is unavailable (e.g. unstarted or in_progress attempts)' do
|
64
|
-
# we expect 2 blank durations, and 1 blank start time (1 unstarted log entry w/ blank start and duration, 1 in_progress w/ blank duration)
|
65
|
-
expect(rendered).to have_css('table.table-striped td', text: /^$/, count: 3)
|
66
|
-
end
|
67
|
-
|
68
68
|
it 'displays the status of the reindexing attempt using localized text' do
|
69
|
-
expect(rendered).to have_css('table.table-striped td', text: 'Not
|
69
|
+
expect(rendered).to have_css('table.table-striped td', text: 'Not yet started', count: 1)
|
70
70
|
expect(rendered).to have_css('table.table-striped td', text: 'Successful', count: 2)
|
71
|
-
expect(rendered).to have_css('table.table-striped td', text: 'In
|
71
|
+
expect(rendered).to have_css('table.table-striped td', text: 'In progress', count: 1)
|
72
72
|
expect(rendered).to have_css('table.table-striped td', text: 'Failed', count: 1)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
context 'a reindexing log entry has a null user' do
|
77
|
+
let(:recent_reindexing) do
|
78
|
+
[FactoryBot.build(:job_tracker, status: 'completed', data: { progress: 10 }, user: nil)]
|
79
|
+
end
|
80
|
+
|
77
81
|
it 'displays blank in the user field and renders without error' do
|
78
|
-
assign(:recent_reindexing, [FactoryBot.build(:reindexing_log_entry_no_user)])
|
79
82
|
expect { render p }.not_to raise_error
|
80
83
|
|
81
84
|
# we expect one blank table cell for the user, and values for everything else
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
describe 'spotlight/metadata_configurations/_metadata_field', type: :view do
|
4
4
|
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:field) { Blacklight::Configuration::Field.new immutable: OpenStruct.new(another_view_type: false) }
|
6
|
+
let(:builder) { ActionView::Helpers::FormBuilder.new 'z', nil, view, {} }
|
5
7
|
let(:p) { 'spotlight/metadata_configurations/metadata_field.html.erb' }
|
8
|
+
|
6
9
|
before do
|
7
10
|
assign(:exhibit, exhibit)
|
8
11
|
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
@@ -14,9 +17,6 @@ describe 'spotlight/metadata_configurations/_metadata_field', type: :view do
|
|
14
17
|
)
|
15
18
|
end
|
16
19
|
|
17
|
-
let(:field) { Blacklight::Configuration::Field.new immutable: OpenStruct.new(another_view_type: false) }
|
18
|
-
let(:builder) { ActionView::Helpers::FormBuilder.new 'z', nil, view, {} }
|
19
|
-
|
20
20
|
it 'uses the index_field_label helper to render the label' do
|
21
21
|
allow(view).to receive(:index_field_label).with(anything, 'some_key').and_return 'Some label'
|
22
22
|
render partial: p, locals: { key: 'some_key', config: field, f: builder }
|
@@ -11,6 +11,7 @@ describe 'spotlight/pages/show', type: :view do
|
|
11
11
|
|
12
12
|
before do
|
13
13
|
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
14
|
+
allow(view).to receive(:render_body_class).and_return('')
|
14
15
|
assign(:page, page)
|
15
16
|
stub_template 'spotlight/pages/_sidebar.html.erb' => 'Sidebar'
|
16
17
|
stub_template 'spotlight/pages/_tophat.html.erb' => ''
|
@@ -29,7 +29,7 @@ describe 'spotlight/search_configurations/_facets', type: :view do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'shows the config for the non-empty personal name facet' do
|
32
|
-
expect(rendered).to have_content 'Personal
|
32
|
+
expect(rendered).to have_content 'Personal names'
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'shows the config for the empty custom facet' do
|
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
describe 'spotlight/search_configurations/_sort', type: :view do
|
4
4
|
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:f) do
|
6
|
+
form_helper = nil
|
7
|
+
controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f|
|
8
|
+
form_helper = f
|
9
|
+
end
|
10
|
+
form_helper
|
11
|
+
end
|
5
12
|
|
6
13
|
before do
|
7
14
|
original_config = Spotlight::Engine.blacklight_config.deep_dup
|
@@ -16,14 +23,6 @@ describe 'spotlight/search_configurations/_sort', type: :view do
|
|
16
23
|
)
|
17
24
|
end
|
18
25
|
|
19
|
-
let(:f) do
|
20
|
-
form_helper = nil
|
21
|
-
controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f|
|
22
|
-
form_helper = f
|
23
|
-
end
|
24
|
-
form_helper
|
25
|
-
end
|
26
|
-
|
27
26
|
it 'has a disabled relevance sort option' do
|
28
27
|
render partial: 'spotlight/search_configurations/sort', locals: { f: f }
|
29
28
|
expect(rendered).to have_selector "input[name='blacklight_configuration[sort_fields][relevance][enable]'][disabled='disabled']"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'spotlight/translations/_import.html.erb', type: :view do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
allow(view).to receive(:can?).and_return(true)
|
8
|
+
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
9
|
+
assign(:language, :es)
|
10
|
+
I18n.default_locale = 'en'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'has a link to export the translation data' do
|
14
|
+
render
|
15
|
+
expect(rendered).to have_link 'Export English', href: spotlight.exhibit_translations_path(exhibit_id: exhibit, format: 'yaml', locale: 'en')
|
16
|
+
expect(rendered).to have_link 'Export Spanish', href: spotlight.exhibit_translations_path(exhibit_id: exhibit, format: 'yaml', locale: 'es')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has a form to import the translation data' do
|
20
|
+
render
|
21
|
+
expect(rendered).to have_selector "form[action='#{spotlight.import_exhibit_translations_path(exhibit_id: exhibit)}']"
|
22
|
+
expect(rendered).to have_selector 'input[name="file"]'
|
23
|
+
end
|
24
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Leaflet-IIIF
|
2
|
+
* Leaflet-IIIF 3.0.0
|
3
3
|
* IIIF Viewer for Leaflet
|
4
4
|
* by Jack Reed, @mejackreed
|
5
5
|
*/
|
@@ -32,7 +32,7 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
32
32
|
}
|
33
33
|
|
34
34
|
options = L.setOptions(this, options);
|
35
|
-
this.
|
35
|
+
this._infoPromise = null;
|
36
36
|
this._infoUrl = url;
|
37
37
|
this._baseUrl = this._templateUrl();
|
38
38
|
this._getInfo();
|
@@ -48,27 +48,39 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
48
48
|
miny = (y * tileBaseSize),
|
49
49
|
maxx = Math.min(minx + tileBaseSize, _this.x),
|
50
50
|
maxy = Math.min(miny + tileBaseSize, _this.y);
|
51
|
-
|
51
|
+
|
52
52
|
var xDiff = (maxx - minx);
|
53
53
|
var yDiff = (maxy - miny);
|
54
54
|
|
55
|
+
// Canonical URI Syntax for v2
|
56
|
+
var size = Math.ceil(xDiff / scale) + ',';
|
57
|
+
if (_this.type === 'ImageService3') {
|
58
|
+
// Cannonical URI Syntax for v3
|
59
|
+
size = size + Math.ceil(yDiff / scale);
|
60
|
+
}
|
61
|
+
|
55
62
|
return L.Util.template(this._baseUrl, L.extend({
|
56
63
|
format: _this.options.tileFormat,
|
57
64
|
quality: _this.quality,
|
58
65
|
region: [minx, miny, xDiff, yDiff].join(','),
|
59
66
|
rotation: 0,
|
60
|
-
size:
|
67
|
+
size: size
|
61
68
|
}, this.options));
|
62
69
|
},
|
63
70
|
onAdd: function(map) {
|
64
71
|
var _this = this;
|
65
72
|
|
66
|
-
// Wait for
|
67
|
-
|
73
|
+
// Wait for info.json fetch and parse to complete
|
74
|
+
Promise.all([_this._infoPromise]).then(function() {
|
75
|
+
// Store unmutated imageSizes
|
76
|
+
_this._imageSizesOriginal = _this._imageSizes.slice(0);
|
68
77
|
|
69
78
|
// Set maxZoom for map
|
70
79
|
map._layersMaxZoom = _this.maxZoom;
|
71
80
|
|
81
|
+
// Call add TileLayer
|
82
|
+
L.TileLayer.prototype.onAdd.call(_this, map);
|
83
|
+
|
72
84
|
// Set minZoom and minNativeZoom based on how the imageSizes match up
|
73
85
|
var smallestImage = _this._imageSizes[0];
|
74
86
|
var mapSize = _this._map.getSize();
|
@@ -88,9 +100,6 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
88
100
|
_this._prev_map_layersMinZoom = _this._map._layersMinZoom;
|
89
101
|
_this._map._layersMinZoom = newMinZoom;
|
90
102
|
|
91
|
-
// Call add TileLayer
|
92
|
-
L.TileLayer.prototype.onAdd.call(_this, map);
|
93
|
-
|
94
103
|
if (_this.options.fitBounds) {
|
95
104
|
_this._fitBounds();
|
96
105
|
}
|
@@ -112,12 +121,16 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
112
121
|
tile.tile.style.height = height + 'px';
|
113
122
|
|
114
123
|
});
|
124
|
+
})
|
125
|
+
.catch(function(err){
|
126
|
+
console.error(err);
|
115
127
|
});
|
116
128
|
},
|
117
129
|
onRemove: function(map) {
|
118
130
|
var _this = this;
|
119
|
-
|
131
|
+
|
120
132
|
map._layersMinZoom = _this._prev_map_layersMinZoom;
|
133
|
+
_this._imageSizes = _this._imageSizesOriginal;
|
121
134
|
|
122
135
|
// Remove maxBounds set for this image
|
123
136
|
if(_this.options.setMaxBounds) {
|
@@ -156,9 +169,14 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
156
169
|
_getInfo: function() {
|
157
170
|
var _this = this;
|
158
171
|
|
159
|
-
|
160
|
-
|
161
|
-
|
172
|
+
_this._infoPromise = fetch(_this._infoUrl)
|
173
|
+
.then(function(response) {
|
174
|
+
return response.json();
|
175
|
+
})
|
176
|
+
.catch(function(err){
|
177
|
+
console.error(err);
|
178
|
+
})
|
179
|
+
.then(function(data) {
|
162
180
|
_this.y = data.height;
|
163
181
|
_this.x = data.width;
|
164
182
|
|
@@ -176,6 +194,7 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
176
194
|
}else {
|
177
195
|
_this.profile = data.profile;
|
178
196
|
}
|
197
|
+
_this.type = data.type;
|
179
198
|
|
180
199
|
_this._setQuality();
|
181
200
|
|
@@ -197,10 +216,13 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
197
216
|
};
|
198
217
|
|
199
218
|
// Calculates maximum native zoom for the layer
|
200
|
-
_this.maxNativeZoom = Math.max(
|
201
|
-
ceilLog2(_this.
|
219
|
+
_this.maxNativeZoom = Math.max(
|
220
|
+
ceilLog2(_this.x / _this.options.tileSize),
|
221
|
+
ceilLog2(_this.y / _this.options.tileSize),
|
222
|
+
0
|
223
|
+
);
|
202
224
|
_this.options.maxNativeZoom = _this.maxNativeZoom;
|
203
|
-
|
225
|
+
|
204
226
|
// Enable zooming further than native if maxZoom option supplied
|
205
227
|
if (_this._customMaxZoom && _this.options.maxZoom > _this.maxNativeZoom) {
|
206
228
|
_this.maxZoom = _this.options.maxZoom;
|
@@ -208,7 +230,7 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
208
230
|
else {
|
209
231
|
_this.maxZoom = _this.maxNativeZoom;
|
210
232
|
}
|
211
|
-
|
233
|
+
|
212
234
|
for (var i = 0; i <= _this.maxZoom; i++) {
|
213
235
|
scale = Math.pow(2, _this.maxNativeZoom - i);
|
214
236
|
width_ = Math.ceil(_this.x / scale);
|
@@ -221,10 +243,11 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
221
243
|
|
222
244
|
_this._tierSizes = tierSizes;
|
223
245
|
_this._imageSizes = imageSizes;
|
224
|
-
|
225
|
-
|
226
|
-
|
246
|
+
})
|
247
|
+
.catch(function(err){
|
248
|
+
console.error(err);
|
227
249
|
});
|
250
|
+
|
228
251
|
},
|
229
252
|
|
230
253
|
_setQuality: function() {
|
@@ -259,7 +282,6 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
259
282
|
return this._infoToBaseUrl() + '{region}/{size}/{rotation}/{quality}.{format}';
|
260
283
|
},
|
261
284
|
_isValidTile: function(coords) {
|
262
|
-
var tileBounds = this._tileCoordsToBounds(coords);
|
263
285
|
var _this = this;
|
264
286
|
var zoom = _this._getZoomForUrl();
|
265
287
|
var sizes = _this._tierSizes[zoom];
|
@@ -276,6 +298,9 @@ L.TileLayer.Iiif = L.TileLayer.extend({
|
|
276
298
|
return true;
|
277
299
|
}
|
278
300
|
},
|
301
|
+
_tileShouldBeLoaded: function(coords) {
|
302
|
+
return this._isValidTile(coords);
|
303
|
+
},
|
279
304
|
_getInitialZoom: function (mapSize) {
|
280
305
|
var _this = this;
|
281
306
|
var tolerance = 0.8;
|