blacklight 6.7.0 → 6.8.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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -0
  3. data/.rubocop_todo.yml +69 -40
  4. data/.travis.yml +9 -8
  5. data/Gemfile +1 -0
  6. data/VERSION +1 -1
  7. data/app/assets/stylesheets/blacklight/_header.scss +9 -1
  8. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +2 -1
  9. data/app/controllers/concerns/blacklight/catalog.rb +2 -2
  10. data/app/controllers/concerns/blacklight/controller.rb +6 -1
  11. data/app/controllers/concerns/blacklight/facet.rb +5 -5
  12. data/app/controllers/concerns/blacklight/request_builders.rb +2 -2
  13. data/app/controllers/concerns/blacklight/token_based_user.rb +12 -1
  14. data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +7 -7
  15. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
  16. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +1 -1
  17. data/app/models/concerns/blacklight/document.rb +6 -1
  18. data/app/models/concerns/blacklight/user.rb +3 -4
  19. data/app/presenters/blacklight/link_alternate_presenter.rb +8 -4
  20. data/app/presenters/blacklight/rendering/pipeline.rb +6 -1
  21. data/app/views/catalog/_facet_limit.html.erb +2 -2
  22. data/blacklight.gemspec +2 -2
  23. data/config/locales/blacklight.es.yml +1 -0
  24. data/config/locales/blacklight.fr.yml +1 -0
  25. data/config/locales/blacklight.pt-BR.yml +17 -0
  26. data/lib/blacklight/configuration.rb +3 -13
  27. data/lib/blacklight/search_state.rb +6 -2
  28. data/lib/blacklight/solr/repository.rb +1 -1
  29. data/lib/blacklight/solr/response/spelling.rb +2 -2
  30. data/lib/blacklight/solr/response.rb +1 -1
  31. data/lib/blacklight/solr/search_builder_behavior.rb +6 -6
  32. data/lib/generators/blacklight/templates/catalog_controller.rb +2 -0
  33. data/spec/controllers/blacklight/search_helper_spec.rb +15 -1
  34. data/spec/controllers/catalog_controller_spec.rb +18 -0
  35. data/spec/features/autocomplete_spec.rb +6 -0
  36. data/spec/helpers/deprecated_url_helper_behavior_spec.rb +1 -0
  37. data/spec/helpers/facets_helper_spec.rb +0 -2
  38. data/spec/helpers/render_constraints_helper_spec.rb +1 -0
  39. data/spec/models/blacklight/document_spec.rb +15 -2
  40. data/spec/models/blacklight/solr/search_builder_spec.rb +46 -0
  41. data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +30 -0
  42. data/spec/presenters/pipeline_spec.rb +9 -0
  43. data/spec/spec_helper.rb +1 -0
  44. metadata +17 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d9d1db7c5b929bb935e9ce41c06af1c4707856c
4
- data.tar.gz: 328b4f96a2f73164e0ee3a8b298157ee4025e9ad
3
+ metadata.gz: 7659ba5e00f78c03a1a4f10c0b3aa010290f3101
4
+ data.tar.gz: eff65628374ba2a260ce76c62a8e6fbcc7eea314
5
5
  SHA512:
6
- metadata.gz: 0690cbe4599e64337bbb09a07c9125b6828ee4734ec2f1d38311dbe178d519df9c8bed4fad85c2276d957d8c74d3089a46579c69e864501b41fe6066adba0fef
7
- data.tar.gz: 9a11b1e9ebe49ae02dfb2395e94cd696a38949e4632dd204d4361254bb41d6f0cd5b90117cdae41434862d174daca5ca33fcaf5bb1d60b01a54105141a31fa21
6
+ metadata.gz: e6fc2330aa0cd95b868358e8d4761a88a0eca3bbcc7bf3513b843983ff894f87539f289d453c55fa95122f4a0943860d8c8522969f85ea0ccd50cbeda82513cf
7
+ data.tar.gz: c176bbe0a6cbaf3c5eea74a13d644a113e7daf87750be9782303ab36081d15da334d23dff1ca6dc2a8e3885c58efd0dac1ddc419f73db63d3b7fbbec6a443ce2
data/.rubocop.yml CHANGED
@@ -4,9 +4,11 @@ inherit_from:
4
4
  - .rubocop_todo.yml
5
5
 
6
6
  AllCops:
7
+ DisplayCopNames: true
7
8
  Exclude:
8
9
  - "lib/generators/blacklight/templates/**/*"
9
10
  - "spec/**/*"
11
+ - "blacklight.gemspec"
10
12
 
11
13
  Rails:
12
14
  Enabled: true
@@ -26,3 +28,13 @@ Rails/OutputSafety:
26
28
  Style/MethodMissing:
27
29
  Exclude:
28
30
  - 'lib/blacklight/utils.rb'
31
+
32
+ # engine_cart block includes conditional, not duplication
33
+ Bundler/DuplicatedGem:
34
+ Exclude:
35
+ - 'Gemfile'
36
+
37
+ # engine_cart block is following default Rails order
38
+ Bundler/OrderedGems:
39
+ Exclude:
40
+ - 'Gemfile'
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-08-25 07:56:15 -0700 using RuboCop version 0.42.0.
3
+ # on 2017-03-03 12:59:32 -0800 using RuboCop version 0.47.1.
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
@@ -8,8 +8,8 @@
8
8
 
9
9
  # Offense count: 19
10
10
  # Cop supports --auto-correct.
11
- # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
12
- # SupportedStyles: keyword, variable, start_of_line
11
+ # Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
12
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
13
13
  Lint/EndAlignment:
14
14
  Exclude:
15
15
  - 'app/controllers/concerns/blacklight/token_based_user.rb'
@@ -25,7 +25,7 @@ Lint/EndAlignment:
25
25
  - 'lib/blacklight/solr/response/facets.rb'
26
26
  - 'lib/blacklight/solr/search_builder_behavior.rb'
27
27
 
28
- # Offense count: 30
28
+ # Offense count: 26
29
29
  # Cop supports --auto-correct.
30
30
  # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
31
31
  Lint/UnusedBlockArgument:
@@ -33,7 +33,6 @@ Lint/UnusedBlockArgument:
33
33
  - 'app/controllers/concerns/blacklight/search_context.rb'
34
34
  - 'app/helpers/blacklight/configuration_helper_behavior.rb'
35
35
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
36
- - 'lib/blacklight/configuration.rb'
37
36
  - 'lib/blacklight/configuration/fields.rb'
38
37
  - 'lib/blacklight/engine.rb'
39
38
  - 'lib/blacklight/parameters.rb'
@@ -42,12 +41,11 @@ Lint/UnusedBlockArgument:
42
41
  - 'lib/railties/blacklight.rake'
43
42
  - 'tasks/blacklight.rake'
44
43
 
45
- # Offense count: 21
44
+ # Offense count: 19
46
45
  # Cop supports --auto-correct.
47
46
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
48
47
  Lint/UnusedMethodArgument:
49
48
  Exclude:
50
- - 'app/controllers/concerns/blacklight/default_component_configuration.rb'
51
49
  - 'app/helpers/blacklight/blacklight_helper_behavior.rb'
52
50
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
53
51
  - 'app/helpers/blacklight/component_helper_behavior.rb'
@@ -74,24 +72,30 @@ Lint/UselessAssignment:
74
72
  - 'lib/blacklight/solr/response/spelling.rb'
75
73
  - 'lib/railties/blacklight.rake'
76
74
 
77
- # Offense count: 61
75
+ # Offense count: 62
78
76
  Metrics/AbcSize:
79
77
  Max: 53
80
78
 
79
+ # Offense count: 4
80
+ # Configuration parameters: CountComments, ExcludedMethods.
81
+ Metrics/BlockLength:
82
+ Max: 94
83
+
81
84
  # Offense count: 1
85
+ # Configuration parameters: CountBlocks.
82
86
  Metrics/BlockNesting:
83
87
  Max: 4
84
88
 
85
89
  # Offense count: 2
86
90
  # Configuration parameters: CountComments.
87
91
  Metrics/ClassLength:
88
- Max: 200
92
+ Max: 186
89
93
 
90
94
  # Offense count: 20
91
95
  Metrics/CyclomaticComplexity:
92
96
  Max: 12
93
97
 
94
- # Offense count: 59
98
+ # Offense count: 53
95
99
  # Configuration parameters: CountComments.
96
100
  Metrics/MethodLength:
97
101
  Max: 52
@@ -99,7 +103,7 @@ Metrics/MethodLength:
99
103
  # Offense count: 9
100
104
  # Configuration parameters: CountComments.
101
105
  Metrics/ModuleLength:
102
- Max: 213
106
+ Max: 208
103
107
 
104
108
  # Offense count: 1
105
109
  # Configuration parameters: CountKeywordArgs.
@@ -110,6 +114,25 @@ Metrics/ParameterLists:
110
114
  Metrics/PerceivedComplexity:
111
115
  Max: 14
112
116
 
117
+ # Offense count: 2
118
+ Rails/FilePath:
119
+ Exclude:
120
+ - 'app/controllers/concerns/blacklight/catalog.rb'
121
+
122
+ # Offense count: 1
123
+ # Configuration parameters: Blacklist.
124
+ # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
125
+ Rails/SkipsModelValidations:
126
+ Exclude:
127
+ - 'app/controllers/concerns/blacklight/saved_searches.rb'
128
+
129
+ # Offense count: 2
130
+ # Cop supports --auto-correct.
131
+ Security/YAMLLoad:
132
+ Exclude:
133
+ - 'lib/blacklight.rb'
134
+ - 'lib/railties/blacklight.rake'
135
+
113
136
  # Offense count: 2
114
137
  # Cop supports --auto-correct.
115
138
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
@@ -132,7 +155,7 @@ Style/Alias:
132
155
  - 'lib/blacklight/solr/response.rb'
133
156
  - 'lib/blacklight/solr/response/group_response.rb'
134
157
 
135
- # Offense count: 7
158
+ # Offense count: 6
136
159
  # Cop supports --auto-correct.
137
160
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
138
161
  # SupportedStyles: with_first_parameter, with_fixed_indentation
@@ -143,7 +166,7 @@ Style/AlignParameters:
143
166
  - 'lib/blacklight/configuration.rb'
144
167
  - 'lib/generators/blacklight/solr4_generator.rb'
145
168
 
146
- # Offense count: 66
169
+ # Offense count: 64
147
170
  # Cop supports --auto-correct.
148
171
  # Configuration parameters: EnforcedStyle, SupportedStyles.
149
172
  # SupportedStyles: always, conditionals
@@ -162,7 +185,7 @@ Style/BracesAroundHashParameters:
162
185
 
163
186
  # Offense count: 13
164
187
  # Cop supports --auto-correct.
165
- # Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
188
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentOneStep, IndentationWidth.
166
189
  # SupportedStyles: case, end
167
190
  Style/CaseIndentation:
168
191
  Exclude:
@@ -180,7 +203,7 @@ Style/ClassAndModuleChildren:
180
203
 
181
204
  # Offense count: 2
182
205
  # Cop supports --auto-correct.
183
- # Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
206
+ # Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
184
207
  # SupportedStyles: assign_to_condition, assign_inside_condition
185
208
  Style/ConditionalAssignment:
186
209
  Exclude:
@@ -216,7 +239,7 @@ Style/ElseAlignment:
216
239
  - 'lib/blacklight/solr/response/facets.rb'
217
240
  - 'lib/blacklight/solr/search_builder_behavior.rb'
218
241
 
219
- # Offense count: 26
242
+ # Offense count: 20
220
243
  # Cop supports --auto-correct.
221
244
  # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
222
245
  Style/ExtraSpacing:
@@ -224,11 +247,8 @@ Style/ExtraSpacing:
224
247
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
225
248
  - 'app/helpers/blacklight/configuration_helper_behavior.rb'
226
249
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
227
- - 'app/models/concerns/blacklight/document/export.rb'
228
250
  - 'app/models/record_mailer.rb'
229
- - 'blacklight.gemspec'
230
251
  - 'config/routes.rb'
231
- - 'lib/blacklight/configuration.rb'
232
252
  - 'lib/generators/blacklight/controller_generator.rb'
233
253
  - 'lib/generators/blacklight/document_generator.rb'
234
254
  - 'lib/generators/blacklight/install_generator.rb'
@@ -236,7 +256,14 @@ Style/ExtraSpacing:
236
256
  - 'lib/railties/blacklight.rake'
237
257
  - 'tasks/blacklight.rake'
238
258
 
239
- # Offense count: 9
259
+ # Offense count: 2
260
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
261
+ # SupportedStyles: format, sprintf, percent
262
+ Style/FormatString:
263
+ Exclude:
264
+ - 'app/helpers/blacklight/render_partials_helper.rb'
265
+
266
+ # Offense count: 10
240
267
  # Configuration parameters: MinBodyLength.
241
268
  Style/GuardClause:
242
269
  Exclude:
@@ -250,11 +277,11 @@ Style/GuardClause:
250
277
  # Offense count: 111
251
278
  # Cop supports --auto-correct.
252
279
  # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
253
- # SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
280
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
254
281
  Style/HashSyntax:
255
282
  Enabled: false
256
283
 
257
- # Offense count: 16
284
+ # Offense count: 15
258
285
  # Cop supports --auto-correct.
259
286
  # Configuration parameters: MaxLineLength.
260
287
  Style/IfUnlessModifier:
@@ -265,7 +292,6 @@ Style/IfUnlessModifier:
265
292
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
266
293
  - 'app/helpers/blacklight/url_helper_behavior.rb'
267
294
  - 'app/models/blacklight/facet_paginator.rb'
268
- - 'lib/blacklight/configuration.rb'
269
295
  - 'lib/blacklight/configuration/fields.rb'
270
296
  - 'lib/blacklight/search_state.rb'
271
297
  - 'lib/generators/blacklight/install_generator.rb'
@@ -308,7 +334,7 @@ Style/LeadingCommentSpace:
308
334
  - 'lib/blacklight/configuration.rb'
309
335
  - 'lib/blacklight/solr/response/spelling.rb'
310
336
 
311
- # Offense count: 139
337
+ # Offense count: 125
312
338
  # Cop supports --auto-correct.
313
339
  # Configuration parameters: EnforcedStyle, SupportedStyles.
314
340
  # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
@@ -322,6 +348,13 @@ Style/MultilineBlockLayout:
322
348
  - 'lib/generators/blacklight/install_generator.rb'
323
349
  - 'lib/generators/blacklight/test_support_generator.rb'
324
350
 
351
+ # Offense count: 3
352
+ # Cop supports --auto-correct.
353
+ Style/MultilineIfModifier:
354
+ Exclude:
355
+ - 'lib/blacklight/solr/response/facets.rb'
356
+ - 'lib/blacklight/solr/search_builder_behavior.rb'
357
+
325
358
  # Offense count: 13
326
359
  # Cop supports --auto-correct.
327
360
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
@@ -331,7 +364,7 @@ Style/MultilineMethodCallIndentation:
331
364
  - 'app/controllers/concerns/blacklight/search_helper.rb'
332
365
  - 'lib/blacklight/search_builder.rb'
333
366
 
334
- # Offense count: 13
367
+ # Offense count: 12
335
368
  # Cop supports --auto-correct.
336
369
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
337
370
  # SupportedStyles: aligned, indented
@@ -372,7 +405,7 @@ Style/PredicateName:
372
405
  Style/RedundantSelf:
373
406
  Enabled: false
374
407
 
375
- # Offense count: 24
408
+ # Offense count: 17
376
409
  # Cop supports --auto-correct.
377
410
  Style/SpaceAfterComma:
378
411
  Exclude:
@@ -381,7 +414,6 @@ Style/SpaceAfterComma:
381
414
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
382
415
  - 'app/helpers/blacklight/render_constraints_helper_behavior.rb'
383
416
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
384
- - 'lib/blacklight/configuration.rb'
385
417
  - 'lib/blacklight/configuration/fields.rb'
386
418
  - 'lib/blacklight/parameters.rb'
387
419
  - 'lib/blacklight/solr/response/facets.rb'
@@ -390,14 +422,14 @@ Style/SpaceAfterComma:
390
422
 
391
423
  # Offense count: 3
392
424
  # Cop supports --auto-correct.
393
- # Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
394
- # SupportedStyles: space, no_space
425
+ # Configuration parameters: EnforcedStyleInsidePipes, SupportedStylesInsidePipes.
426
+ # SupportedStylesInsidePipes: space, no_space
395
427
  Style/SpaceAroundBlockParameters:
396
428
  Exclude:
397
429
  - 'app/controllers/concerns/blacklight/catalog.rb'
398
430
  - 'app/models/concerns/blacklight/document/extensions.rb'
399
431
 
400
- # Offense count: 27
432
+ # Offense count: 26
401
433
  # Cop supports --auto-correct.
402
434
  # Configuration parameters: EnforcedStyle, SupportedStyles.
403
435
  # SupportedStyles: space, no_space
@@ -408,7 +440,6 @@ Style/SpaceAroundEqualsInParameterDefault:
408
440
  - 'app/helpers/blacklight/component_helper_behavior.rb'
409
441
  - 'app/helpers/blacklight/configuration_helper_behavior.rb'
410
442
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
411
- - 'app/helpers/blacklight/render_partials_helper.rb'
412
443
  - 'app/helpers/blacklight/url_helper_behavior.rb'
413
444
  - 'app/models/concerns/blacklight/document.rb'
414
445
  - 'app/presenters/blacklight/document_presenter.rb'
@@ -416,7 +447,7 @@ Style/SpaceAroundEqualsInParameterDefault:
416
447
  - 'app/presenters/blacklight/show_presenter.rb'
417
448
  - 'lib/blacklight/search_state.rb'
418
449
 
419
- # Offense count: 13
450
+ # Offense count: 11
420
451
  # Cop supports --auto-correct.
421
452
  # Configuration parameters: AllowForAlignment.
422
453
  Style/SpaceAroundOperators:
@@ -426,8 +457,6 @@ Style/SpaceAroundOperators:
426
457
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
427
458
  - 'app/helpers/blacklight/search_history_constraints_helper_behavior.rb'
428
459
  - 'app/helpers/blacklight/url_helper_behavior.rb'
429
- - 'app/models/concerns/blacklight/document/export.rb'
430
- - 'lib/blacklight/configuration.rb'
431
460
  - 'lib/blacklight/solr/repository.rb'
432
461
  - 'lib/blacklight/solr/response/spelling.rb'
433
462
  - 'tasks/blacklight.rake'
@@ -462,8 +491,9 @@ Style/SpaceBeforeFirstArg:
462
491
 
463
492
  # Offense count: 15
464
493
  # Cop supports --auto-correct.
465
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
494
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
466
495
  # SupportedStyles: space, no_space
496
+ # SupportedStylesForEmptyBraces: space, no_space
467
497
  Style/SpaceInsideBlockBraces:
468
498
  Exclude:
469
499
  - 'app/controllers/concerns/blacklight/bookmarks.rb'
@@ -484,8 +514,9 @@ Style/SpaceInsideBrackets:
484
514
 
485
515
  # Offense count: 18
486
516
  # Cop supports --auto-correct.
487
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
517
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
488
518
  # SupportedStyles: space, no_space, compact
519
+ # SupportedStylesForEmptyBraces: space, no_space
489
520
  Style/SpaceInsideHashLiteralBraces:
490
521
  Exclude:
491
522
  - 'app/controllers/concerns/blacklight/bookmarks.rb'
@@ -497,14 +528,13 @@ Style/SpaceInsideHashLiteralBraces:
497
528
  - 'lib/blacklight/configuration.rb'
498
529
  - 'lib/blacklight/solr/repository.rb'
499
530
 
500
- # Offense count: 19
531
+ # Offense count: 18
501
532
  # Cop supports --auto-correct.
502
533
  Style/SpaceInsideParens:
503
534
  Exclude:
504
535
  - 'app/controllers/concerns/blacklight/search_context.rb'
505
536
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
506
537
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
507
- - 'app/helpers/blacklight/render_constraints_helper_behavior.rb'
508
538
  - 'app/helpers/blacklight/search_history_constraints_helper_behavior.rb'
509
539
  - 'app/helpers/blacklight/url_helper_behavior.rb'
510
540
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
@@ -513,8 +543,7 @@ Style/SpaceInsideParens:
513
543
  - 'lib/blacklight/search_state.rb'
514
544
  - 'lib/blacklight/solr/search_builder_behavior.rb'
515
545
 
516
- # Offense count: 217
546
+ # Offense count: 199
517
547
  # Cop supports --auto-correct.
518
548
  Style/TrailingWhitespace:
519
549
  Enabled: false
520
-
data/.travis.yml CHANGED
@@ -9,21 +9,22 @@ rvm:
9
9
 
10
10
  matrix:
11
11
  include:
12
- - rvm: 2.3.1
13
- env: "RAILS_VERSION=4.2.6"
14
- - rvm: 2.2.5
15
- env: "RAILS_VERSION=5.0.0"
16
- - rvm: jruby-9.0.5.0
17
- env: "RAILS_VERSION=4.2.6 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
12
+ - rvm: 2.3.3
13
+ env: "RAILS_VERSION=4.2.8"
14
+ - rvm: 2.2.6
15
+ env: "RAILS_VERSION=5.0.2"
16
+ - rvm: jruby-9.1.7.0
17
+ env: "RAILS_VERSION=5.0.2 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
18
18
  allow_failures:
19
- - rvm: jruby-9.0.5.0
19
+ - rvm: jruby-9.1.7.0
20
20
  fast_finish: true
21
21
 
22
22
  before_install:
23
+ - gem update --system
23
24
  - gem install bundler
24
25
 
25
26
  env:
26
- - "RAILS_VERSION=5.0.0"
27
+ - "RAILS_VERSION=5.0.2"
27
28
 
28
29
  notifications:
29
30
  irc: "irc.freenode.org#blacklight"
data/Gemfile CHANGED
@@ -36,6 +36,7 @@ else
36
36
  gem 'responders', '~> 2.0'
37
37
  gem 'sass-rails', '>= 5.0'
38
38
  gem 'coffee-rails', '~> 4.1.0'
39
+ gem 'json', '~> 1.8'
39
40
  when /^4.[01]/
40
41
  gem 'sass-rails', '< 5.0'
41
42
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.7.0
1
+ 6.8.0
@@ -6,7 +6,15 @@
6
6
  .navbar-brand { /* The main logo image for the Blacklight instance */
7
7
  width: 150px;
8
8
  height: 50px;
9
- background:transparent image_url($logo_image) no-repeat top left;
9
+ @if $logo-image {
10
+ background: transparent $logo-image no-repeat top left;
11
+ }
12
+
13
+ @if $logo_image {
14
+ // deprecated
15
+ background: transparent image_url($logo_image) no-repeat top left;
16
+ }
17
+
10
18
  display: inline-block;
11
19
  text-indent: 100%;
12
20
  white-space: nowrap;
@@ -1,6 +1,7 @@
1
1
  /* Warning! If you want to change these, just copy them into your own theme css. But you want to remove the !default, which only will set them if not already set. */
2
2
 
3
- $logo_image: 'blacklight/logo.png' !default;
3
+ $logo-image: image_url('blacklight/logo.png') !default;
4
+ $logo_image: false !default; // deprecated
4
5
 
5
6
  /* label (field names) */
6
7
  $field_name_color: $text-muted !default;
@@ -68,7 +68,7 @@ module Blacklight::Catalog
68
68
  def facet
69
69
  @facet = blacklight_config.facet_fields[params[:id]]
70
70
  @response = get_facet_field_response(@facet.key, params)
71
- @display_facet = @response.aggregations[@facet.key]
71
+ @display_facet = @response.aggregations[@facet.field]
72
72
  @pagination = facet_paginator(@facet, @display_facet)
73
73
  respond_to do |format|
74
74
  # Draw the facet selector for users who have javascript disabled:
@@ -179,7 +179,7 @@ module Blacklight::Catalog
179
179
  # By default, any search action from a Blacklight::Catalog controller
180
180
  # should use the current controller when constructing the route.
181
181
  def search_action_url options = {}
182
- url_for(options.merge(action: 'index'))
182
+ url_for(options.reverse_merge(action: 'index'))
183
183
  end
184
184
 
185
185
  # Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
@@ -26,6 +26,11 @@ module Blacklight::Controller
26
26
  helper_method :search_action_url, :search_action_path, :search_facet_url, :search_facet_path
27
27
  helper_method :search_state
28
28
 
29
+ # Specify which class to use for the search state. You can subclass SearchState if you
30
+ # want to override any of the methods (e.g. SearchState#url_for_document)
31
+ class_attribute :search_state_class
32
+ self.search_state_class = Blacklight::SearchState
33
+
29
34
  # This callback runs when a user first logs in
30
35
 
31
36
  define_callbacks :logging_in_user
@@ -62,7 +67,7 @@ module Blacklight::Controller
62
67
 
63
68
  # @return [Blacklight::SearchState] a memoized instance of the parameter state.
64
69
  def search_state
65
- @search_state ||= Blacklight::SearchState.new(params, blacklight_config)
70
+ @search_state ||= search_state_class.new(params, blacklight_config)
66
71
  end
67
72
 
68
73
  # Default route to the search action (used e.g. in global partials). Override this method
@@ -6,12 +6,12 @@ module Blacklight
6
6
  module Facet
7
7
  delegate :facet_configuration_for_field, to: :blacklight_config
8
8
 
9
- def facet_paginator(field_config, display_facet)
9
+ def facet_paginator(field_config, response_data)
10
10
  blacklight_config.facet_paginator_class.new(
11
- display_facet.items,
12
- sort: display_facet.sort,
13
- offset: display_facet.offset,
14
- prefix: display_facet.prefix,
11
+ response_data.items,
12
+ sort: response_data.sort,
13
+ offset: response_data.offset,
14
+ prefix: response_data.prefix,
15
15
  limit: facet_limit_for(field_config.key)
16
16
  )
17
17
  end
@@ -56,8 +56,8 @@ module Blacklight
56
56
  facet = blacklight_config.facet_fields[facet_field]
57
57
  return if facet.blank?
58
58
 
59
- if facet.limit and @response and @response.aggregations[facet_field]
60
- limit = @response.aggregations[facet_field].limit
59
+ if facet.limit and @response and @response.aggregations[facet.field]
60
+ limit = @response.aggregations[facet.field].limit
61
61
 
62
62
  if limit.nil? # we didn't get or a set a limit, so infer one.
63
63
  facet.limit if facet.limit != true
@@ -42,10 +42,21 @@ module Blacklight::TokenBasedUser
42
42
  end
43
43
 
44
44
  def export_secret_token
45
- ActiveSupport::KeyGenerator.new(Rails.application.secrets.secret_key_base).generate_key('encrypted user session key')
45
+ ActiveSupport::KeyGenerator.new(Rails.application.secrets.secret_key_base).generate_key('encrypted user session key')[0..(key_len - 1)]
46
46
  end
47
47
 
48
48
  def message_encryptor
49
49
  ActiveSupport::MessageEncryptor.new(export_secret_token)
50
50
  end
51
+
52
+ private
53
+
54
+ # Ruby 2.4 requires keys of very particular lengths
55
+ def key_len
56
+ if ActiveSupport::MessageEncryptor.respond_to? :key_len
57
+ ActiveSupport::MessageEncryptor.key_len
58
+ else
59
+ 0
60
+ end
61
+ end
51
62
  end
@@ -11,8 +11,8 @@ module Blacklight
11
11
  when 1
12
12
  search_state.params_for_search(args.first)
13
13
  when 2
14
- Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use Blacklight::SearchState.new(source_params).params_for_search instead')
15
- Blacklight::SearchState.new(args.first, blacklight_config).params_for_search(args.last)
14
+ Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use controller.search_state_class.new(source_params).params_for_search instead')
15
+ controller.search_state_class.new(args.first, blacklight_config).params_for_search(args.last)
16
16
  else
17
17
  raise ArgumentError, "wrong number of arguments (#{args.length} for 0..2)"
18
18
  end
@@ -25,15 +25,15 @@ module Blacklight
25
25
  deprecation_deprecate :sanitize_search_params
26
26
 
27
27
  def reset_search_params(source_params)
28
- Blacklight::SearchState.new(source_params, blacklight_config).send(:reset_search_params)
28
+ controller.search_state_class.new(source_params, blacklight_config).send(:reset_search_params)
29
29
  end
30
30
  deprecation_deprecate :reset_search_params
31
31
 
32
32
  def add_facet_params(field, item, source_params = nil)
33
33
  if source_params
34
- Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use Blacklight::SearchState.new(source_params).add_facet_params instead')
34
+ Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use controller.search_state_class.new(source_params).add_facet_params instead')
35
35
 
36
- Blacklight::SearchState.new(source_params, blacklight_config).add_facet_params(field, item)
36
+ controller.search_state_class.new(source_params, blacklight_config).add_facet_params(field, item)
37
37
  else
38
38
  search_state.add_facet_params(field, item)
39
39
  end
@@ -42,9 +42,9 @@ module Blacklight
42
42
 
43
43
  def remove_facet_params(field, item, source_params = nil)
44
44
  if source_params
45
- Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use Blacklight::SearchState.new(source_params).remove_facet_params instead')
45
+ Deprecation.warn(Blacklight::DeprecatedUrlHelperBehavior, 'Use controller.search_state_class.new(source_params).remove_facet_params instead')
46
46
 
47
- Blacklight::SearchState.new(source_params, blacklight_config).remove_facet_params(field, item)
47
+ controller.search_state_class.new(source_params, blacklight_config).remove_facet_params(field, item)
48
48
  else
49
49
  search_state.remove_facet_params(field, item)
50
50
  end
@@ -91,7 +91,7 @@ module Blacklight::FacetsHelperBehavior
91
91
  # @param [Blacklight::Configuration::FacetField] facet_field
92
92
  # @return [Boolean]
93
93
  def should_collapse_facet? facet_field
94
- !facet_field_in_params?(facet_field.field) && facet_field.collapse
94
+ !facet_field_in_params?(facet_field.key) && facet_field.collapse
95
95
  end
96
96
 
97
97
  ##
@@ -65,7 +65,7 @@ module Blacklight::RenderConstraintsHelperBehavior
65
65
  # @return [String]
66
66
  def render_constraints_filters(localized_params = params)
67
67
  return "".html_safe unless localized_params[:f]
68
- path = Blacklight::SearchState.new(localized_params, blacklight_config)
68
+ path = controller.search_state_class.new(localized_params, blacklight_config)
69
69
  content = []
70
70
  localized_params[:f].each_pair do |facet,values|
71
71
  content << render_filter_element(facet, values, path)
@@ -44,7 +44,12 @@ module Blacklight::Document
44
44
  delegate :[], :key?, :keys, :to_h, to: :_source
45
45
 
46
46
  def initialize(source_doc={}, response=nil)
47
- @_source = ActiveSupport::HashWithIndifferentAccess.new(source_doc)
47
+ @_source = if source_doc.respond_to?(:to_hash)
48
+ ActiveSupport::HashWithIndifferentAccess.new(source_doc)
49
+ else
50
+ Deprecation.warn(Blacklight::Document, "Blacklight::Document#initialize expects a hash-like object, received #{source_doc.class}.")
51
+ ActiveSupport::HashWithIndifferentAccess.new(source_doc.to_h)
52
+ end
48
53
  @response = response
49
54
  apply_extensions
50
55
  end
@@ -5,10 +5,9 @@ module Blacklight::User
5
5
  # SEE ALSO: The /lib/blacklight/engine.rb class for how when this
6
6
  # is injected into the hosting application through ActiveRecord::Base extend
7
7
  def self.included(base)
8
- if base.respond_to? :has_many
9
- base.send :has_many, :bookmarks, :dependent => :destroy, :as => :user
10
- base.send :has_many, :searches, :dependent => :destroy, :as => :user
11
- end
8
+ return unless base.respond_to? :has_many
9
+ base.send :has_many, :bookmarks, :dependent => :destroy, :as => :user
10
+ base.send :has_many, :searches, :dependent => :destroy, :as => :user
12
11
  end
13
12
 
14
13
  def bookmarks_for_documents documents = []