blacklight-spotlight 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +2 -4
  4. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +2 -2
  5. data/app/controllers/concerns/spotlight/controller.rb +13 -12
  6. data/app/controllers/spotlight/attachments_controller.rb +1 -1
  7. data/app/controllers/spotlight/custom_search_fields_controller.rb +1 -1
  8. data/app/controllers/spotlight/pages_controller.rb +1 -1
  9. data/app/controllers/spotlight/searches_controller.rb +6 -1
  10. data/app/helpers/spotlight/application_helper.rb +1 -1
  11. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  12. data/app/mailers/spotlight/confirmation_mailer.rb +2 -1
  13. data/app/models/spotlight/contact_email.rb +1 -1
  14. data/app/models/spotlight/page_configurations.rb +1 -1
  15. data/app/services/spotlight/exhibit_import_export_service.rb +1 -1
  16. data/app/views/spotlight/catalog/admin.html.erb +1 -1
  17. data/app/views/spotlight/confirmation_mailer/confirmation_instructions.html.erb +3 -3
  18. data/app/views/spotlight/exhibits/_import.html.erb +1 -1
  19. data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
  20. data/app/views/spotlight/filters/_form.html.erb +1 -1
  21. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  22. data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
  23. data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +4 -2
  24. data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
  25. data/app/views/spotlight/searches/_form.html.erb +1 -1
  26. data/app/views/spotlight/translations/_browse_categories.html.erb +1 -1
  27. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  28. data/app/views/spotlight/translations/_import.html.erb +1 -1
  29. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  30. data/app/views/spotlight/translations/_search_fields.html.erb +1 -1
  31. data/config/i18n-tasks.yml +1 -1
  32. data/config/locales/spotlight.en.yml +12 -3
  33. data/lib/generators/spotlight/templates/config/initializers/translation.rb +13 -11
  34. data/lib/spotlight/engine.rb +3 -1
  35. data/lib/spotlight/version.rb +1 -1
  36. data/lib/tasks/spotlight_tasks.rake +20 -5
  37. data/spec/examples.txt +1505 -1496
  38. data/spec/features/edit_search_fields_spec.rb +1 -1
  39. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +2 -0
  40. data/spec/helpers/spotlight/pages_helper_spec.rb +1 -1
  41. data/spec/models/solr_document_spec.rb +3 -3
  42. data/spec/models/spotlight/page_spec.rb +1 -1
  43. data/spec/spec_helper.rb +1 -1
  44. data/spec/test_app_templates/catalog_controller.rb +3 -3
  45. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +27 -1
  46. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
  47. metadata +13 -7
@@ -23,7 +23,7 @@ describe 'Search Administration', type: :feature do
23
23
  within("[data-id='genre_ssim']") do
24
24
  expect(page).to have_content('Genre')
25
25
  expect(page).to have_content(/\d+ items/)
26
- expect(page).to have_content(/(\d+) unique values/)
26
+ expect(page).to have_content(/([\d+]+) unique values/)
27
27
  end
28
28
  end
29
29
 
@@ -140,6 +140,8 @@ describe 'Solr Document Block', feature: true, versioning: true, default_max_wai
140
140
  end
141
141
 
142
142
  it 'allows you to optionally display a ZPR link with the image', js: true do
143
+ skip('Passes locally, but soooo flakey on Travis.') if ENV['CI']
144
+
143
145
  fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'
144
146
 
145
147
  check 'Offer "View larger" option'
@@ -46,7 +46,7 @@ describe Spotlight::PagesHelper, type: :helper do
46
46
  let(:search_result) { [double('response'), double('documents')] }
47
47
 
48
48
  it 'returns the results for a given search browse category' do
49
- expect(helper).to receive(:search_results).with('q' => 'query').and_return(search_result)
49
+ expect(helper).to receive(:search_results).with({ 'q' => 'query' }).and_return(search_result)
50
50
  expect(helper.get_search_widget_search_results(good)).to eq search_result
51
51
  end
52
52
 
@@ -74,7 +74,7 @@ describe SolrDocument, type: :model do
74
74
  it 'stores sidecar data on the sidecar object' do
75
75
  mock_sidecar = double
76
76
  allow(subject).to receive_messages(sidecar: mock_sidecar)
77
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => 1 })
77
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => 1 } })
78
78
  subject.update exhibit, sidecar: { data: { 'a' => 1 } }
79
79
  end
80
80
 
@@ -86,14 +86,14 @@ describe SolrDocument, type: :model do
86
86
  it 'converts empty strings to nil' do
87
87
  mock_sidecar = double
88
88
  allow(subject).to receive_messages(sidecar: mock_sidecar)
89
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => nil })
89
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => nil } })
90
90
  subject.update exhibit, sidecar: { data: { 'a' => '' } }
91
91
  end
92
92
 
93
93
  it 'compacts arrays of empty or nil values' do
94
94
  mock_sidecar = double
95
95
  allow(subject).to receive_messages(sidecar: mock_sidecar)
96
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => ['a'] })
96
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => ['a'] } })
97
97
  subject.update exhibit, sidecar: { data: { 'a' => ['', nil, 'a'] } }
98
98
  end
99
99
  end
@@ -130,7 +130,7 @@ describe Spotlight::Page, type: :model do
130
130
  expect(page.slug).to eq 'abc'
131
131
  end
132
132
 
133
- it 'blacklists contacts' do
133
+ it 'reserves the slug "contacts"' do
134
134
  page.update(title: 'contacts')
135
135
  expect(page.slug).not_to eq 'contacts'
136
136
  end
data/spec/spec_helper.rb CHANGED
@@ -29,7 +29,7 @@ Capybara.register_driver :headless_chrome do |app|
29
29
  opts.args << '--no-sandbox'
30
30
  opts.args << '--window-size=1280,1696'
31
31
  end
32
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
32
+ Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: [browser_options])
33
33
  end
34
34
  require 'webmock/rspec'
35
35
  allowed_sites = ['chromedriver.storage.googleapis.com']
@@ -6,10 +6,10 @@ 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
9
+ config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)
10
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
11
+ config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent)
12
+ config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent)
13
13
  config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
14
14
  config.show.partials.insert(1, :openseadragon)
15
15
  ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
@@ -1,8 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe 'spotlight/search_configurations/_facet_metadata', type: :view do
4
+ let(:field_config) { nil }
5
+ let(:blacklight_config) { nil }
6
+
4
7
  before do
5
- render partial: 'spotlight/search_configurations/facet_metadata', locals: { metadata: metadata }
8
+ render partial: 'spotlight/search_configurations/facet_metadata', locals: {
9
+ blacklight_config: blacklight_config,
10
+ field_config: field_config,
11
+ metadata: metadata
12
+ }
6
13
  end
7
14
 
8
15
  context 'with a facet without any documents' do
@@ -29,4 +36,23 @@ describe 'spotlight/search_configurations/_facet_metadata', type: :view do
29
36
  expect(rendered).to have_content '20+ unique values'
30
37
  end
31
38
  end
39
+
40
+ context 'with a facet with a configured limit' do
41
+ let(:metadata) { { document_count: 1, value_count: 10, terms: %w[] } }
42
+ let(:field_config) { Blacklight::Configuration::FacetField.new(limit: 10) }
43
+
44
+ it 'shows there are many unique values' do
45
+ expect(rendered).to have_content '10+ unique values'
46
+ end
47
+ end
48
+
49
+ context 'with a facet with an implicit limit' do
50
+ let(:blacklight_config) { CatalogController.blacklight_config }
51
+ let(:metadata) { { document_count: 1, value_count: 13, terms: %w[] } }
52
+ let(:field_config) { Blacklight::Configuration::FacetField.new(limit: true) }
53
+
54
+ it 'shows there are many unique values' do
55
+ expect(rendered).to have_content '10+ unique values'
56
+ end
57
+ end
32
58
  end
@@ -18,7 +18,6 @@ describe 'spotlight/tags/index.html.erb', type: :view do
18
18
  describe 'Tags' do
19
19
  it 'is displayed' do
20
20
  render
21
- puts rendered
22
21
  [tag1.tag.name, tag2.tag.name].each do |name|
23
22
  expect(rendered).to have_css('h4', text: name)
24
23
  expect(rendered).to have_link(name, href: '#edit-in-place')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-10-08 00:00:00.000000000 Z
14
+ date: 2022-03-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob-status
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: '5.0'
37
37
  - - "<"
38
38
  - !ruby/object:Gem::Version
39
- version: '8'
39
+ version: '10'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '5.0'
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
- version: '8'
49
+ version: '10'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: autoprefixer-rails
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -431,16 +431,22 @@ dependencies:
431
431
  name: paper_trail
432
432
  requirement: !ruby/object:Gem::Requirement
433
433
  requirements:
434
- - - "~>"
434
+ - - ">="
435
435
  - !ruby/object:Gem::Version
436
436
  version: '11.0'
437
+ - - "<"
438
+ - !ruby/object:Gem::Version
439
+ version: '13'
437
440
  type: :runtime
438
441
  prerelease: false
439
442
  version_requirements: !ruby/object:Gem::Requirement
440
443
  requirements:
441
- - - "~>"
444
+ - - ">="
442
445
  - !ruby/object:Gem::Version
443
446
  version: '11.0'
447
+ - - "<"
448
+ - !ruby/object:Gem::Version
449
+ version: '13'
444
450
  - !ruby/object:Gem::Dependency
445
451
  name: rails
446
452
  requirement: !ruby/object:Gem::Requirement
@@ -1835,7 +1841,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1835
1841
  - !ruby/object:Gem::Version
1836
1842
  version: '0'
1837
1843
  requirements: []
1838
- rubygems_version: 3.2.3
1844
+ rubygems_version: 3.2.32
1839
1845
  signing_key:
1840
1846
  specification_version: 4
1841
1847
  summary: Enable librarians, curators, and others who are responsible for digital collections