blacklight 8.1.0 → 8.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +8 -6
  3. data/.rubocop_todo.yml +20 -5
  4. data/VERSION +1 -1
  5. data/app/assets/javascripts/blacklight/blacklight.esm.js +44 -21
  6. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  7. data/app/assets/javascripts/blacklight/blacklight.js +44 -21
  8. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  9. data/app/assets/stylesheets/blacklight/_mixins.scss +1 -1
  10. data/app/components/blacklight/advanced_search_form_component.html.erb +3 -3
  11. data/app/components/blacklight/advanced_search_form_component.rb +1 -1
  12. data/app/components/blacklight/document/bookmark_component.html.erb +1 -6
  13. data/app/components/blacklight/facet_field_component.html.erb +2 -1
  14. data/app/components/blacklight/icons/legacy_icon_component.rb +1 -1
  15. data/app/components/blacklight/response/facet_group_component.html.erb +0 -1
  16. data/app/components/blacklight/search_bar_component.html.erb +1 -1
  17. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  18. data/app/controllers/concerns/blacklight/token_based_user.rb +5 -19
  19. data/app/helpers/blacklight/url_helper_behavior.rb +3 -2
  20. data/app/javascript/blacklight/bookmark_toggle.js +1 -1
  21. data/app/javascript/blacklight/checkbox_submit.js +15 -10
  22. data/app/javascript/blacklight/index.js +10 -5
  23. data/app/javascript/blacklight/modal.js +27 -13
  24. data/app/javascript/blacklight/search_context.js +1 -0
  25. data/app/values/blacklight/types.rb +14 -0
  26. data/app/views/catalog/_advanced_search_form.html.erb +1 -1
  27. data/app/views/catalog/_citation.html.erb +1 -1
  28. data/app/views/catalog/email.html.erb +2 -2
  29. data/app/views/catalog/sms.html.erb +2 -2
  30. data/app/views/kaminari/blacklight/_page.html.erb +1 -1
  31. data/blacklight.gemspec +1 -1
  32. data/config/locales/blacklight.ar.yml +0 -1
  33. data/config/locales/blacklight.ca.yml +0 -2
  34. data/config/locales/blacklight.de.yml +0 -1
  35. data/config/locales/blacklight.en.yml +0 -1
  36. data/config/locales/blacklight.es.yml +0 -1
  37. data/config/locales/blacklight.fr.yml +0 -1
  38. data/config/locales/blacklight.hu.yml +0 -1
  39. data/config/locales/blacklight.it.yml +0 -1
  40. data/config/locales/blacklight.nl.yml +0 -1
  41. data/config/locales/blacklight.pt-BR.yml +0 -1
  42. data/config/locales/blacklight.sq.yml +0 -1
  43. data/config/locales/blacklight.zh.yml +0 -1
  44. data/docker-compose.yml +0 -2
  45. data/lib/blacklight/solr/repository.rb +3 -1
  46. data/lib/blacklight/solr/response/params.rb +1 -1
  47. data/lib/blacklight/solr/search_builder_behavior.rb +2 -0
  48. data/lib/generators/blacklight/assets/importmap_generator.rb +2 -2
  49. data/lib/generators/blacklight/assets/sprockets_generator.rb +1 -1
  50. data/lib/generators/blacklight/assets_generator.rb +1 -1
  51. data/package.json +1 -1
  52. data/spec/controllers/catalog_controller_spec.rb +2 -2
  53. data/spec/features/advanced_search_spec.rb +6 -0
  54. data/spec/features/citation_spec.rb +10 -0
  55. data/spec/features/sms_spec.rb +12 -0
  56. data/spec/models/blacklight/solr/response_spec.rb +1 -1
  57. data/spec/models/blacklight/solr/search_builder_spec.rb +13 -0
  58. data/spec/models/solr_document_spec.rb +6 -2
  59. data/spec/spec_helper.rb +0 -28
  60. data/spec/test_app_templates/Gemfile.extra +0 -1
  61. data/template.demo.rb +7 -7
  62. metadata +9 -5
@@ -118,5 +118,11 @@ RSpec.describe "Blacklight Advanced Search Form" do
118
118
  expect(page.current_url).to match(/bread/)
119
119
  expect(page.current_url).not_to match(/medicine/)
120
120
  end
121
+
122
+ it "clears the prepopulated fields when the Start Over button is pressed" do
123
+ expect(page).to have_field 'Title', with: 'medicine'
124
+ click_on 'Start over'
125
+ expect(page).not_to have_field 'Title', with: 'medicine'
126
+ end
121
127
  end
122
128
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe 'Citation functionality' do
4
+ before { visit solr_document_path('2007020969') }
5
+
6
+ it 'displays the Cite modal with expected header' do
7
+ click_link 'Cite'
8
+ expect(find('div.modal-header')).to have_text 'Cite'
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe 'SMS functionality' do
4
+ before { visit solr_document_path('2007020969') }
5
+
6
+ it 'displays SMS modal with form' do
7
+ click_link 'SMS'
8
+ expect(find('div.modal-header')).to have_text 'SMS This'
9
+ fill_in 'Phone Number:', with: '555-555-5555'
10
+ select 'Verizon', from: 'Carrier'
11
+ end
12
+ end
@@ -48,7 +48,7 @@ RSpec.describe Blacklight::Solr::Response, api: true do
48
48
 
49
49
  expect(received).to eq expected
50
50
 
51
- r.aggregations.each do |_key, facet|
51
+ r.aggregations.each_value do |facet|
52
52
  expect(facet).to respond_to :name
53
53
  expect(facet).to respond_to :sort
54
54
  expect(facet).to respond_to :offset
@@ -335,6 +335,7 @@ RSpec.describe Blacklight::Solr::SearchBuilderBehavior, api: true do
335
335
  qf: '$subject_qf',
336
336
  pf: '$subject_pf'
337
337
  }
338
+ blacklight_config.search_fields['subject'].clause_params = nil
338
339
  end
339
340
 
340
341
  it "looks up qt from field definition" do
@@ -374,6 +375,18 @@ RSpec.describe Blacklight::Solr::SearchBuilderBehavior, api: true do
374
375
  expect(key_value_pairs).to include("pf=$subject_pf")
375
376
  expect(key_value_pairs).to include("qf=$subject_qf")
376
377
  end
378
+
379
+ context 'when subject field uses JSON query DSL' do
380
+ before do
381
+ blacklight_config.search_fields['subject'].clause_params = {
382
+ edismax: {}
383
+ }
384
+ end
385
+
386
+ it "includes spellcheck.q, without LocalParams" do
387
+ expect(subject["spellcheck.q"]).to eq "wome"
388
+ end
389
+ end
377
390
  end
378
391
 
379
392
  describe "solr json query parameters from the fielded search" do
@@ -49,6 +49,7 @@ RSpec.describe SolrDocument, api: true do
49
49
  attribute :author, :array, 'author_tesim', of: :string
50
50
  attribute :first_author, :select, 'author_tesim', by: :min
51
51
  attribute :date, :date, field: 'date_dtsi'
52
+ attribute :time, :time, field: 'date_dtsi'
52
53
  attribute :whatever, :string, default: ->(*) { 'default_value' }
53
54
  end
54
55
  end
@@ -56,14 +57,17 @@ RSpec.describe SolrDocument, api: true do
56
57
  doc_class.new(id: '123',
57
58
  title_tesim: ['Good Omens'],
58
59
  author_tesim: ['Neil Gaiman', 'Terry Pratchett'],
59
- date_dtsi: '1990-01-01T00:00:00Z')
60
+ date_dtsi: '1990-01-01T17:23:13Z')
60
61
  end
61
62
 
62
63
  it "casts the attributes" do
63
64
  expect(document.title).to eq 'Good Omens'
64
65
  expect(document.author).to eq ['Neil Gaiman', 'Terry Pratchett']
65
66
  expect(document.first_author).to eq 'Neil Gaiman'
66
- expect(document.date).to eq Date.new(1990)
67
+ expect(document.date).to be_a Date
68
+ expect(document.date.to_s).to eq '1990-01-01'
69
+ expect(document.time).to be_a Time
70
+ expect(document.time.to_s).to eq '1990-01-01 17:23:13 UTC'
67
71
  expect(document.whatever).to eq 'default_value'
68
72
  end
69
73
 
data/spec/spec_helper.rb CHANGED
@@ -118,31 +118,3 @@ RSpec.configure do |config|
118
118
  # as the one that triggered the failure.
119
119
  Kernel.srand config.seed
120
120
  end
121
-
122
- # RSpec's stub_template method needs a differnet implementation for Rails 7.1, that
123
- # isn't yet in an rspec-rails release.
124
- #
125
- # First rspec-rails tried this:
126
- # https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
127
- #
128
- # But it was subject to this problem:
129
- # https://github.com/rspec/rspec-rails/issues/2696
130
- #
131
- # Below implementation appears to work for our purposes here, so we will patch it in
132
- # if we are on Rails 7.1+, and not yet rspec-rails 6.1 which we expect to have it.
133
-
134
- if ::Rails.version.to_f >= 7.1 && Gem.loaded_specs["rspec-rails"].version.release < Gem::Version.new('6.1')
135
-
136
- module RSpec
137
- module Rails
138
- module ViewExampleGroup
139
- module ExampleMethods
140
- def stub_template(hash)
141
- controller.prepend_view_path(StubResolverCache.resolver_for(hash))
142
- end
143
- end
144
- end
145
- end
146
- end
147
-
148
- end
@@ -1,5 +1,4 @@
1
1
  gem 'rails-controller-testing'
2
- gem 'thor', '~> 0.20' if /^5.[12]/.match?(ENV['RAILS_VERSION'])
3
2
 
4
3
  unless ENV['VIEW_COMPONENT_VERSION'].to_s == ""
5
4
  gem 'view_component', ENV.fetch('VIEW_COMPONENT_VERSION')
data/template.demo.rb CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  gem 'blacklight', '>= 7.0'
4
4
 
5
- run "bundle install"
5
+ after_bundle do
6
+ # run the blacklight install generator
7
+ options = ENV.fetch("BLACKLIGHT_INSTALL_OPTIONS", '--devise --marc')
6
8
 
7
- # run the blacklight install generator
8
- options = ENV.fetch("BLACKLIGHT_INSTALL_OPTIONS", '--devise --marc')
9
+ generate 'blacklight:install', options
9
10
 
10
- generate 'blacklight:install', options
11
-
12
- # run the database migrations
13
- rake "db:migrate"
11
+ # run the database migrations
12
+ rake "db:migrate"
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2023-11-09 00:00:00.000000000 Z
20
+ date: 2024-05-31 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -155,14 +155,14 @@ dependencies:
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '6.0'
158
+ version: '6.1'
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '6.0'
165
+ version: '6.1'
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: rspec-collection_matchers
168
168
  requirement: !ruby/object:Gem::Requirement
@@ -788,6 +788,7 @@ files:
788
788
  - spec/features/autocomplete_spec.rb
789
789
  - spec/features/axe_spec.rb
790
790
  - spec/features/bookmarks_spec.rb
791
+ - spec/features/citation_spec.rb
791
792
  - spec/features/component_template_override_spec.rb
792
793
  - spec/features/did_you_mean_spec.rb
793
794
  - spec/features/facet_missing_spec.rb
@@ -804,6 +805,7 @@ files:
804
805
  - spec/features/search_sort_spec.rb
805
806
  - spec/features/search_spec.rb
806
807
  - spec/features/sitelinks_search_box_spec.rb
808
+ - spec/features/sms_spec.rb
807
809
  - spec/fixtures/sample_solr_documents.yml
808
810
  - spec/helpers/blacklight/configuration_helper_behavior_spec.rb
809
811
  - spec/helpers/blacklight/facets_helper_behavior_spec.rb
@@ -923,7 +925,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
923
925
  - !ruby/object:Gem::Version
924
926
  version: '0'
925
927
  requirements: []
926
- rubygems_version: 3.4.21
928
+ rubygems_version: 3.5.10
927
929
  signing_key:
928
930
  specification_version: 4
929
931
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -965,6 +967,7 @@ test_files:
965
967
  - spec/features/autocomplete_spec.rb
966
968
  - spec/features/axe_spec.rb
967
969
  - spec/features/bookmarks_spec.rb
970
+ - spec/features/citation_spec.rb
968
971
  - spec/features/component_template_override_spec.rb
969
972
  - spec/features/did_you_mean_spec.rb
970
973
  - spec/features/facet_missing_spec.rb
@@ -981,6 +984,7 @@ test_files:
981
984
  - spec/features/search_sort_spec.rb
982
985
  - spec/features/search_spec.rb
983
986
  - spec/features/sitelinks_search_box_spec.rb
987
+ - spec/features/sms_spec.rb
984
988
  - spec/fixtures/sample_solr_documents.yml
985
989
  - spec/helpers/blacklight/configuration_helper_behavior_spec.rb
986
990
  - spec/helpers/blacklight/facets_helper_behavior_spec.rb