blacklight 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +11 -0
  4. data/.rubocop.yml +4 -0
  5. data/.rubocop_todo.yml +67 -73
  6. data/VERSION +1 -1
  7. data/app/builders/blacklight/action_builder.rb +1 -1
  8. data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
  9. data/app/components/blacklight/advanced_search_form_component.rb +2 -2
  10. data/app/components/blacklight/document/sidebar_component.html.erb +1 -1
  11. data/app/components/blacklight/document/sidebar_component.rb +12 -0
  12. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  13. data/app/components/blacklight/response/pagination_component.rb +11 -2
  14. data/app/components/blacklight/search_bar_component.html.erb +1 -1
  15. data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
  16. data/app/helpers/blacklight/blacklight_helper_behavior.rb +10 -0
  17. data/app/models/concerns/blacklight/document/active_model_shim.rb +10 -0
  18. data/app/models/search.rb +6 -1
  19. data/app/services/blacklight/field_retriever.rb +13 -11
  20. data/app/views/catalog/_show_tools.html.erb +1 -0
  21. data/app/views/layouts/blacklight/base.html.erb +0 -3
  22. data/blacklight.gemspec +1 -2
  23. data/config/locales/blacklight.en.yml +1 -0
  24. data/lib/blacklight/component.rb +1 -1
  25. data/lib/blacklight/configuration.rb +10 -1
  26. data/lib/blacklight/engine.rb +12 -0
  27. data/lib/blacklight/solr/repository.rb +14 -2
  28. data/lib/blacklight/solr/search_builder_behavior.rb +2 -1
  29. data/lib/generators/blacklight/assets_generator.rb +1 -3
  30. data/lib/generators/blacklight/install_generator.rb +1 -3
  31. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -0
  32. data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +69 -0
  33. data/lib/railties/blacklight.rake +4 -4
  34. data/package.json +2 -2
  35. data/spec/components/blacklight/document/sidebar_component_spec.rb +63 -0
  36. data/spec/components/blacklight/facet_component_spec.rb +11 -1
  37. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +2 -2
  38. data/spec/components/blacklight/response/pagination_component_spec.rb +53 -0
  39. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +11 -1
  40. data/spec/features/advanced_search_spec.rb +55 -0
  41. data/spec/features/axe_spec.rb +5 -0
  42. data/spec/helpers/blacklight_helper_spec.rb +10 -5
  43. data/spec/models/blacklight/configurable_spec.rb +1 -1
  44. data/spec/models/blacklight/solr/repository_spec.rb +27 -0
  45. data/spec/models/blacklight/solr/search_builder_spec.rb +8 -0
  46. data/spec/presenters/blacklight/show_presenter_spec.rb +4 -10
  47. data/spec/services/blacklight/field_retriever_spec.rb +17 -0
  48. data/spec/spec_helper.rb +29 -2
  49. data/spec/support/view_component_test_helpers.rb +14 -0
  50. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -0
  51. metadata +11 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf15f6dbb817f0839a3b5729997535274d21043ff834b4882cbd50af5ad37f05
4
- data.tar.gz: 57101760654230e5c50eaae71bdaf2fc679230d2ed739ad2023a1f48cea7a2ea
3
+ metadata.gz: 11ad99a6e80c1f34752f093ff2313c459baf620b763c1d51d63c43e899a89445
4
+ data.tar.gz: 507c9d95e30e9cbb9230b7772050204ca60ea62cb68a9707e5823faa40c2a362
5
5
  SHA512:
6
- metadata.gz: bd8d458da8677de400d1e96104fbb0d0831ba674a1d1790dbfcdf2b4e939cc270dc6b263f48d20e2ddd309f5cff7a312d003d573cb4ab5b9455ecd970c8caa99
7
- data.tar.gz: f2f66d799ca0c97a97705fb8d9d7f71ac2f374a9d0f69ecf02e620a5223ee1a72054b3911c8025959276a26bb71d6b852d3ab196d7b151d1d5aea3964a720e93
6
+ metadata.gz: 555cbff4a1b669ef5e7f14ed415137e03158ad8ec6881c3365cb9714a6de9a6f08efc62ff2fc037b83dbbead43df14d82625dad982e0a211984b428f6f6f2b97
7
+ data.tar.gz: 67647433a527fb588f46c4e67f5bb23e44c0be61bde4cfcbefcf0796c44228c7c6c435c1c0e071fd812a80ce04c19701a331c7f8bc043fc6a82a618da4f82f0a
data/.env CHANGED
@@ -1,6 +1,6 @@
1
1
  ALPINE_RUBY_VERSION=3.0.3
2
2
  RAILS_VERSION=6.1.4.6
3
- VIEW_COMPONENT_VERSION=2.6.6
3
+ VIEW_COMPONENT_VERSION=2.66.0
4
4
  SOLR_PORT=8983
5
5
  SOLR_URL=http://solr:8983/solr/blacklight-core
6
6
  SOLR_VERSION=latest
@@ -41,8 +41,18 @@ jobs:
41
41
  additional_engine_cart_rails_options: ['']
42
42
  additional_name: ['']
43
43
  include:
44
+ - ruby: '3.2.2'
45
+ rails_version: '7.1.1'
44
46
  - ruby: '3.2.0'
45
47
  rails_version: '7.0.4'
48
+ - ruby: '3.2.0'
49
+ rails_version: '7.0.4'
50
+ solr_version: '9.3.0'
51
+ additional_name: 'Solr 9.3.0'
52
+ - ruby: '3.2.0'
53
+ rails_version: '7.0.4'
54
+ solr_version: '8.11.2'
55
+ additional_name: 'Solr 8.11.2'
46
56
  - ruby: '3.1'
47
57
  rails_version: '7.0.4'
48
58
  - ruby: '3.1'
@@ -64,6 +74,7 @@ jobs:
64
74
  additional_name: '/ API'
65
75
  env:
66
76
  RAILS_VERSION: ${{ matrix.rails_version }}
77
+ SOLR_VERSION: ${{ matrix.solr_version || 'latest' }}
67
78
  VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
68
79
  BOOTSTRAP_VERSION: ${{ matrix.bootstrap_version }}
69
80
  BLACKLIGHT_API_TEST: ${{ matrix.api }}
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  require:
2
+ - rubocop-capybara
2
3
  - rubocop-rspec
3
4
  - rubocop-rails
4
5
 
@@ -197,6 +198,9 @@ Security/IoMethods: # new in 1.22
197
198
  Enabled: true
198
199
  Style/ArgumentsForwarding: # new in 1.1
199
200
  Enabled: true
201
+ Exclude:
202
+ # This cop includes some checks specific to Ruby 3.2
203
+ - 'lib/blacklight/solr/response/group_response.rb'
200
204
  Style/CollectionCompact: # new in 1.2
201
205
  Enabled: true
202
206
  Style/DocumentDynamicEvalDefinition: # new in 1.1
data/.rubocop_todo.yml CHANGED
@@ -1,20 +1,36 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-06-27 19:52:51 UTC using RuboCop version 1.31.0.
3
+ # on 2023-10-06 15:10:31 UTC using RuboCop version 1.56.4.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 4
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ Capybara/CurrentPathExpectation:
12
+ Exclude:
13
+ - 'spec/features/alternate_controller_spec.rb'
14
+
15
+ # Offense count: 13
16
+ Capybara/VisibilityMatcher:
17
+ Exclude:
18
+ - 'spec/features/facets_spec.rb'
19
+ - 'spec/features/search_filters_spec.rb'
20
+ - 'spec/helpers/blacklight_helper_spec.rb'
21
+
9
22
  # Offense count: 5
10
- # Configuration parameters: AutoCorrect.
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: EnforcedStyle.
25
+ # SupportedStyles: leading, trailing
11
26
  Layout/LineContinuationLeadingSpace:
12
27
  Exclude:
13
28
  - 'lib/generators/blacklight/controller_generator.rb'
14
29
  - 'lib/generators/blacklight/user_generator.rb'
15
30
 
16
31
  # Offense count: 1
17
- # Configuration parameters: IgnoredMethods.
32
+ # This cop supports safe autocorrection (--autocorrect).
33
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
18
34
  Lint/AmbiguousBlockAssociation:
19
35
  Exclude:
20
36
  - 'lib/blacklight/solr/search_builder_behavior.rb'
@@ -29,7 +45,7 @@ Lint/AmbiguousOperator:
29
45
  - 'spec/models/blacklight/solr/search_builder_spec.rb'
30
46
  - 'spec/services/blacklight/search_service_spec.rb'
31
47
 
32
- # Offense count: 44
48
+ # Offense count: 45
33
49
  # This cop supports safe autocorrection (--autocorrect).
34
50
  Lint/AmbiguousRegexpLiteral:
35
51
  Exclude:
@@ -75,7 +91,8 @@ Lint/EmptyFile:
75
91
  Exclude:
76
92
  - 'spec/components/blacklight/document_metadata_component_spec.rb'
77
93
 
78
- # Offense count: 38
94
+ # Offense count: 46
95
+ # Configuration parameters: AllowedParentClasses.
79
96
  Lint/MissingSuper:
80
97
  Enabled: false
81
98
 
@@ -94,14 +111,14 @@ Lint/ShadowingOuterLocalVariable:
94
111
  Exclude:
95
112
  - 'spec/models/blacklight/configuration_spec.rb'
96
113
 
97
- # Offense count: 74
98
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
114
+ # Offense count: 81
115
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
99
116
  Metrics/AbcSize:
100
117
  Max: 46
101
118
 
102
119
  # Offense count: 1
103
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods, inherit_mode.
104
- # IgnoredMethods: refine
120
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
121
+ # AllowedMethods: refine
105
122
  Metrics/BlockLength:
106
123
  Max: 26
107
124
 
@@ -110,32 +127,33 @@ Metrics/BlockLength:
110
127
  Metrics/BlockNesting:
111
128
  Max: 4
112
129
 
113
- # Offense count: 43
114
- # Configuration parameters: IgnoredMethods.
130
+ # Offense count: 42
131
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
115
132
  Metrics/CyclomaticComplexity:
116
133
  Max: 14
117
134
 
118
- # Offense count: 69
119
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
135
+ # Offense count: 77
136
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
120
137
  Metrics/MethodLength:
121
138
  Max: 29
122
139
 
123
- # Offense count: 3
140
+ # Offense count: 4
124
141
  # Configuration parameters: CountComments, CountAsOne.
125
142
  Metrics/ModuleLength:
126
- Max: 126
143
+ Max: 124
127
144
 
128
145
  # Offense count: 8
129
146
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
130
147
  Metrics/ParameterLists:
131
148
  Max: 6
132
149
 
133
- # Offense count: 36
134
- # Configuration parameters: IgnoredMethods.
150
+ # Offense count: 37
151
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
135
152
  Metrics/PerceivedComplexity:
136
153
  Max: 14
137
154
 
138
155
  # Offense count: 3
156
+ # This cop supports unsafe autocorrection (--autocorrect-all).
139
157
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
140
158
  # SupportedStylesForLeadingUnderscores: disallowed, required, optional
141
159
  Naming/MemoizedInstanceVariableName:
@@ -146,7 +164,7 @@ Naming/MemoizedInstanceVariableName:
146
164
 
147
165
  # Offense count: 9
148
166
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
149
- # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
167
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
150
168
  Naming/MethodParameterName:
151
169
  Exclude:
152
170
  - 'app/models/concerns/blacklight/document.rb'
@@ -158,47 +176,33 @@ Naming/MethodParameterName:
158
176
  # Offense count: 9
159
177
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
160
178
  # SupportedStyles: snake_case, normalcase, non_integer
161
- # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
179
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
162
180
  Naming/VariableNumber:
163
181
  Exclude:
164
182
  - 'spec/lib/blacklight/search_state_spec.rb'
165
183
  - 'spec/models/blacklight/search_builder_spec.rb'
166
184
 
167
- # Offense count: 7
185
+ # Offense count: 5
168
186
  RSpec/BeforeAfterAll:
169
187
  Exclude:
170
188
  - 'spec/controllers/search_history_controller_spec.rb'
171
189
  - 'spec/models/blacklight/configurable_spec.rb'
172
190
  - 'spec/models/blacklight/document/dublin_core_spec.rb'
173
- - 'spec/models/blacklight/document/email_spec.rb'
174
- - 'spec/models/blacklight/document/sms_spec.rb'
175
191
  - 'spec/models/blacklight/solr/document_spec.rb'
176
192
 
177
- # Offense count: 4
178
- # This cop supports safe autocorrection (--autocorrect).
179
- RSpec/Capybara/CurrentPathExpectation:
180
- Exclude:
181
- - 'spec/features/alternate_controller_spec.rb'
182
-
183
- # Offense count: 13
184
- RSpec/Capybara/VisibilityMatcher:
185
- Exclude:
186
- - 'spec/features/facets_spec.rb'
187
- - 'spec/features/search_filters_spec.rb'
188
- - 'spec/helpers/blacklight_helper_spec.rb'
189
-
190
- # Offense count: 98
191
- # Configuration parameters: Prefixes.
193
+ # Offense count: 103
194
+ # Configuration parameters: Prefixes, AllowedPatterns.
192
195
  # Prefixes: when, with, without
193
196
  RSpec/ContextWording:
194
197
  Enabled: false
195
198
 
196
199
  # Offense count: 1
200
+ # This cop supports unsafe autocorrection (--autocorrect-all).
197
201
  RSpec/EmptyExampleGroup:
198
202
  Exclude:
199
203
  - 'spec/models/blacklight/solr/search_builder_spec.rb'
200
204
 
201
- # Offense count: 128
205
+ # Offense count: 134
202
206
  # Configuration parameters: CountAsOne.
203
207
  RSpec/ExampleLength:
204
208
  Max: 33
@@ -208,18 +212,17 @@ RSpec/ExpectInHook:
208
212
  Exclude:
209
213
  - 'spec/controllers/catalog_controller_spec.rb'
210
214
 
211
- # Offense count: 5
215
+ # Offense count: 4
212
216
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
213
217
  # Include: **/*_spec*rb*, **/spec/**/*
214
218
  RSpec/FilePath:
215
219
  Exclude:
216
220
  - 'spec/controllers/blacklight/catalog/component_configuration_spec.rb'
217
- - 'spec/features/sitelinks_search_box.rb'
218
221
  - 'spec/models/blacklight/solr/search_builder_spec.rb'
219
222
  - 'spec/presenters/pipeline_spec.rb'
220
223
  - 'spec/presenters/thumbnail_presenter_spec.rb'
221
224
 
222
- # Offense count: 128
225
+ # Offense count: 108
223
226
  # Configuration parameters: AssignmentOnly.
224
227
  RSpec/InstanceVariable:
225
228
  Exclude:
@@ -232,7 +235,6 @@ RSpec/InstanceVariable:
232
235
  - 'spec/models/blacklight/document/dublin_core_spec.rb'
233
236
  - 'spec/models/blacklight/solr/document_spec.rb'
234
237
  - 'spec/models/record_mailer_spec.rb'
235
- - 'spec/models/search_spec.rb'
236
238
  - 'spec/services/blacklight/search_service_spec.rb'
237
239
  - 'spec/views/catalog/index.atom.builder_spec.rb'
238
240
 
@@ -276,21 +278,23 @@ RSpec/MessageSpies:
276
278
  - 'spec/presenters/blacklight/field_presenter_spec.rb'
277
279
  - 'spec/presenters/thumbnail_presenter_spec.rb'
278
280
 
279
- # Offense count: 364
281
+ # Offense count: 379
280
282
  RSpec/MultipleExpectations:
281
283
  Max: 16
282
284
 
283
- # Offense count: 258
285
+ # Offense count: 282
284
286
  # Configuration parameters: AllowSubject.
285
287
  RSpec/MultipleMemoizedHelpers:
286
288
  Max: 14
287
289
 
288
- # Offense count: 388
289
- # Configuration parameters: IgnoreSharedExamples.
290
+ # Offense count: 394
291
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
292
+ # SupportedStyles: always, named_only
290
293
  RSpec/NamedSubject:
291
294
  Enabled: false
292
295
 
293
- # Offense count: 55
296
+ # Offense count: 59
297
+ # Configuration parameters: AllowedGroups.
294
298
  RSpec/NestedGroups:
295
299
  Max: 5
296
300
 
@@ -345,34 +349,27 @@ RSpec/SubjectStub:
345
349
  - 'spec/presenters/blacklight/document_presenter_spec.rb'
346
350
  - 'spec/services/blacklight/search_service_spec.rb'
347
351
 
348
- # Offense count: 77
352
+ # Offense count: 79
349
353
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
350
354
  RSpec/VerifiedDoubles:
351
355
  Enabled: false
352
356
 
353
357
  # Offense count: 4
358
+ # This cop supports unsafe autocorrection (--autocorrect-all).
354
359
  # Configuration parameters: EnforcedStyle, AllowToTime.
355
360
  # SupportedStyles: strict, flexible
356
361
  Rails/Date:
357
362
  Exclude:
358
363
  - 'spec/models/search_spec.rb'
359
364
 
360
- # Offense count: 1
361
- # Configuration parameters: EnforcedStyle.
362
- # SupportedStyles: slashes, arguments
363
- Rails/FilePath:
364
- Exclude:
365
- - 'lib/railties/blacklight.rake'
366
-
367
365
  # Offense count: 20
368
366
  # Configuration parameters: Include.
369
367
  # Include: app/helpers/**/*.rb
370
368
  Rails/HelperInstanceVariable:
371
369
  Exclude:
372
- - 'app/helpers/blacklight/blacklight_helper_behavior.rb'
373
370
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
374
- - 'app/helpers/blacklight/document_helper_behavior.rb'
375
371
  - 'app/helpers/blacklight/component_helper_behavior.rb'
372
+ - 'app/helpers/blacklight/document_helper_behavior.rb'
376
373
  - 'app/helpers/blacklight/layout_helper_behavior.rb'
377
374
  - 'app/helpers/blacklight/render_partials_helper_behavior.rb'
378
375
 
@@ -383,12 +380,9 @@ Rails/I18nLocaleAssignment:
383
380
  Exclude:
384
381
  - 'spec/helpers/blacklight_helper_spec.rb'
385
382
 
386
- # Offense count: 10
383
+ # Offense count: 1
387
384
  Rails/OutputSafety:
388
385
  Exclude:
389
- - 'app/components/blacklight/search_context/server_item_pagination_component.rb'
390
- - 'app/helpers/blacklight/catalog_helper_behavior.rb'
391
- - 'app/helpers/blacklight/configuration_helper_behavior.rb'
392
386
  - 'app/presenters/blacklight/rendering/join.rb'
393
387
 
394
388
  # Offense count: 14
@@ -411,11 +405,11 @@ Style/Alias:
411
405
 
412
406
  # Offense count: 3
413
407
  # This cop supports safe autocorrection (--autocorrect).
414
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
408
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
415
409
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
416
410
  # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
417
411
  # FunctionalMethods: let, let!, subject, watch
418
- # IgnoredMethods: lambda, proc, it
412
+ # AllowedMethods: lambda, proc, it
419
413
  Style/BlockDelimiters:
420
414
  Exclude:
421
415
  - 'app/views/catalog/index.rss.builder'
@@ -449,17 +443,16 @@ Style/DocumentDynamicEvalDefinition:
449
443
  - 'app/builders/blacklight/action_builder.rb'
450
444
  - 'lib/blacklight/configuration/fields.rb'
451
445
 
452
- # Offense count: 105
446
+ # Offense count: 128
453
447
  # Configuration parameters: AllowedConstants.
454
448
  Style/Documentation:
455
449
  Enabled: false
456
450
 
457
- # Offense count: 10
451
+ # Offense count: 9
458
452
  # This cop supports safe autocorrection (--autocorrect).
459
453
  Style/ExpandPathArguments:
460
454
  Exclude:
461
455
  - 'Gemfile'
462
- - 'lib/generators/blacklight/assets_generator.rb'
463
456
  - 'lib/generators/blacklight/controller_generator.rb'
464
457
  - 'lib/generators/blacklight/document_generator.rb'
465
458
  - 'lib/generators/blacklight/install_generator.rb'
@@ -471,12 +464,14 @@ Style/ExpandPathArguments:
471
464
 
472
465
  # Offense count: 16
473
466
  # This cop supports safe autocorrection (--autocorrect).
474
- # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
467
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
475
468
  # SupportedStyles: annotated, template, unannotated
469
+ # AllowedMethods: redirect
476
470
  Style/FormatStringToken:
477
471
  EnforcedStyle: template
478
472
 
479
473
  # Offense count: 6
474
+ # This cop supports safe autocorrection (--autocorrect).
480
475
  # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
481
476
  Style/GuardClause:
482
477
  Exclude:
@@ -486,7 +481,7 @@ Style/GuardClause:
486
481
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
487
482
  - 'lib/blacklight/solr/search_builder_behavior.rb'
488
483
 
489
- # Offense count: 30
484
+ # Offense count: 27
490
485
  # This cop supports safe autocorrection (--autocorrect).
491
486
  Style/IfUnlessModifier:
492
487
  Enabled: false
@@ -501,7 +496,7 @@ Style/MultilineIfModifier:
501
496
 
502
497
  # Offense count: 1
503
498
  # This cop supports safe autocorrection (--autocorrect).
504
- # Configuration parameters: AllowMethodComparison.
499
+ # Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
505
500
  Style/MultipleComparison:
506
501
  Exclude:
507
502
  - 'lib/blacklight/configuration/context.rb'
@@ -516,7 +511,7 @@ Style/MutableConstant:
516
511
 
517
512
  # Offense count: 9
518
513
  # This cop supports unsafe autocorrection (--autocorrect-all).
519
- # Configuration parameters: EnforcedStyle, IgnoredMethods.
514
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
520
515
  # SupportedStyles: predicate, comparison
521
516
  Style/NumericPredicate:
522
517
  Exclude:
@@ -554,13 +549,12 @@ Style/PercentLiteralDelimiters:
554
549
  - 'lib/blacklight/engine.rb'
555
550
  - 'lib/blacklight/solr/request.rb'
556
551
 
557
- # Offense count: 7
552
+ # Offense count: 6
558
553
  # This cop supports safe autocorrection (--autocorrect).
559
554
  # Configuration parameters: EnforcedStyle.
560
555
  # SupportedStyles: implicit, explicit
561
556
  Style/RescueStandardError:
562
557
  Exclude:
563
- - 'app/models/record_mailer.rb'
564
558
  - 'lib/blacklight.rb'
565
559
  - 'lib/blacklight/configuration/fields.rb'
566
560
  - 'lib/railties/blacklight.rake'
@@ -594,7 +588,7 @@ Style/SoleNestedConditional:
594
588
  Exclude:
595
589
  - 'app/controllers/concerns/blacklight/controller.rb'
596
590
 
597
- # Offense count: 34
591
+ # Offense count: 30
598
592
  # This cop supports safe autocorrection (--autocorrect).
599
593
  # Configuration parameters: MinSize.
600
594
  # SupportedStyles: percent, brackets
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.0.0
1
+ 8.1.0
@@ -20,7 +20,7 @@ module Blacklight
20
20
 
21
21
  # Define a simple action handler for the tool as long as the method
22
22
  # doesn't already exist or the `:define_method` option is not `false`
23
- def build
23
+ def build # rubocop:disable Metrics/MethodLength
24
24
  return if skip?
25
25
 
26
26
  callback = opts.fetch(:callback, nil).inspect
@@ -40,7 +40,7 @@
40
40
 
41
41
  <% if sort_fields_select %>
42
42
  <div class="form-group row mb-4">
43
- <%= content_tag :h2, t('blacklight.advanced_search.form.sort_label'), class: 'col-md-3 col-form-label text-md-right' %>
43
+ <%= content_tag :h2, t('blacklight.advanced_search.form.sort_label'), id: 'advanced-search-sort-label', class: 'col-md-3 col-form-label text-md-right' %>
44
44
  <div class="col">
45
45
  <%= sort_fields_select %>
46
46
  </div>
@@ -24,14 +24,14 @@ module Blacklight
24
24
 
25
25
  def default_operator_menu
26
26
  options_with_labels = [:must, :should].index_by { |op| t(op, scope: 'blacklight.advanced_search.op') }
27
- select_tag(:op, options_for_select(options_with_labels, params[:op]), class: 'input-small')
27
+ label_tag(:op, t('blacklight.advanced_search.op.label'), class: 'sr-only visually-hidden') + select_tag(:op, options_for_select(options_with_labels, params[:op]), class: 'input-small')
28
28
  end
29
29
 
30
30
  def sort_fields_select
31
31
  options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
32
32
  return unless options.any?
33
33
 
34
- select_tag(:sort, options_for_select(options, params[:sort]), class: "form-select custom-select sort-select w-auto")
34
+ select_tag(:sort, options_for_select(options, params[:sort]), class: "form-select custom-select sort-select w-auto", aria: { labelledby: 'advanced-search-sort-label' })
35
35
  end
36
36
 
37
37
  private
@@ -1,2 +1,2 @@
1
- <%= render 'show_tools', document: document %>
1
+ <%= render_show_tools %>
2
2
  <%= render(Blacklight::Document::MoreLikeThisComponent.new(document: document)) %>
@@ -11,6 +11,18 @@ module Blacklight
11
11
  end
12
12
 
13
13
  attr_reader :document
14
+
15
+ delegate :blacklight_config, to: :helpers
16
+
17
+ private
18
+
19
+ def render_show_tools
20
+ blacklight_config.view_config(:show).show_tools_component&.tap do |show_tools_component_class|
21
+ return render show_tools_component_class.new(document: document)
22
+ end
23
+
24
+ render 'show_tools', document: document, silence_deprecation: helpers.partial_from_blacklight?('show_tools')
25
+ end
14
26
  end
15
27
  end
16
28
  end
@@ -1,3 +1,3 @@
1
- <%= content_tag :section, class: 'pagination', **@html_attr do %>
1
+ <%= content_tag :section, class: 'paginate-section', **html_attr do %>
2
2
  <%= pagination %>
3
3
  <% end %>
@@ -8,12 +8,21 @@ module Blacklight
8
8
  # @param [Hash] html html options for the pagination container
9
9
  def initialize(response:, html: {}, **pagination_args)
10
10
  @response = response
11
- @html_attr = { aria: { label: t('views.pagination.aria.container_label') } }.merge(html)
11
+ @html = html
12
12
  @pagination_args = pagination_args
13
13
  end
14
14
 
15
+ def html_attr
16
+ { aria: { label: t('views.pagination.aria.container_label') } }.merge(@html)
17
+ end
18
+
15
19
  def pagination
16
- helpers.paginate @response, **Blacklight::Engine.config.blacklight.default_pagination_options, **@pagination_args
20
+ args = configured_options.merge(@pagination_args).compact
21
+ helpers.paginate @response, **args
22
+ end
23
+
24
+ def configured_options
25
+ controller.blacklight_config.index.pagination_options
17
26
  end
18
27
  end
19
28
  end
@@ -1,4 +1,4 @@
1
- <%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, role: 'search', aria: { label: scoped_t('submit') }, **@form_options do |f| %>
1
+ <%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, role: 'search', **@form_options do |f| %>
2
2
  <%= render Blacklight::HiddenSearchStateComponent.new(params: @params) %>
3
3
  <% if search_fields.length > 1 %>
4
4
  <%= f.label :search_field, scoped_t('search_field.label'), class: 'sr-only visually-hidden' %>
@@ -86,7 +86,7 @@ module Blacklight::Bookmarks
86
86
  end
87
87
 
88
88
  if request.xhr?
89
- success ? render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count } }) : render(json: current_or_guest_user.errors.full_messages, status: "500")
89
+ success ? render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count } }) : render(json: current_or_guest_user.errors.full_messages, status: :internal_server_error)
90
90
  else
91
91
  if @bookmarks.any? && success
92
92
  flash[:notice] = I18n.t('blacklight.bookmarks.add.success', count: @bookmarks.length)
@@ -37,4 +37,14 @@ module Blacklight::BlacklightHelperBehavior
37
37
  self.formats = old_formats
38
38
  nil
39
39
  end
40
+
41
+ def self.blacklight_gem_path
42
+ @blacklight_gem_path ||= Gem.loaded_specs["blacklight"].full_gem_path
43
+ end
44
+
45
+ def partial_from_blacklight?(partial)
46
+ path = lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
47
+
48
+ path.nil? ? false : path.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_gem_path)
49
+ end
40
50
  end
@@ -29,6 +29,16 @@ module Blacklight::Document
29
29
  def find id
30
30
  repository.find(id).documents.first
31
31
  end
32
+
33
+ # In Rails 7.1+, needs this method
34
+ def composite_primary_key?
35
+ false
36
+ end
37
+
38
+ # In Rails 7.1+, needs this method
39
+ def has_query_constraints?
40
+ false
41
+ end
32
42
  end
33
43
 
34
44
  ##
data/app/models/search.rb CHANGED
@@ -3,7 +3,12 @@
3
3
  class Search < ApplicationRecord
4
4
  belongs_to :user, optional: true
5
5
 
6
- serialize :query_params, Blacklight::SearchParamsYamlCoder
6
+ if ::Rails.version.to_f >= 7.1
7
+ # non-deprecated coder: keyword arg for Rails 7.1+
8
+ serialize :query_params, coder: Blacklight::SearchParamsYamlCoder
9
+ else
10
+ serialize :query_params, Blacklight::SearchParamsYamlCoder
11
+ end
7
12
 
8
13
  # A Search instance is considered a saved search if it has a user_id.
9
14
  def saved?
@@ -22,17 +22,19 @@ module Blacklight
22
22
 
23
23
  # @return [Array]
24
24
  def fetch
25
- Array.wrap(
26
- if field_config.highlight
27
- retrieve_highlight
28
- elsif field_config.accessor
29
- retieve_using_accessor
30
- elsif field_config.values
31
- retrieve_values
32
- else
33
- retrieve_simple
34
- end
35
- )
25
+ if field_config.highlight
26
+ value = retrieve_highlight
27
+ end
28
+ if value.blank?
29
+ value = if field_config.accessor
30
+ retieve_using_accessor
31
+ elsif field_config.values
32
+ retrieve_values
33
+ else
34
+ retrieve_simple
35
+ end
36
+ end
37
+ Array.wrap(value)
36
38
  end
37
39
 
38
40
  private
@@ -1 +1,2 @@
1
+ <% Blacklight.deprecation.warn('The partial _show_tools.html.erb will be removed in Blacklight 9.0. Configure blacklight_config.show.show_tools_component instead (default Blacklight::Document::ShowToolsComponent).') unless local_assigns[:silence_deprecation] %>
1
2
  <%= render Blacklight::Document::ShowToolsComponent.new(document: document) %>
@@ -5,9 +5,6 @@
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
7
 
8
- <!-- Internet Explorer use the highest version available -->
9
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
10
-
11
8
  <title><%= render_page_title %></title>
12
9
  <script>
13
10
  document.querySelector('html').classList.remove('no-js');