blacklight 6.7.3 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +66 -43
  3. data/.travis.yml +9 -8
  4. data/Gemfile +1 -0
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/_header.scss +9 -1
  7. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +2 -1
  8. data/app/controllers/concerns/blacklight/catalog.rb +1 -1
  9. data/app/controllers/concerns/blacklight/controller.rb +6 -1
  10. data/app/controllers/concerns/blacklight/facet.rb +5 -5
  11. data/app/controllers/concerns/blacklight/request_builders.rb +2 -2
  12. data/app/controllers/concerns/blacklight/token_based_user.rb +12 -1
  13. data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +7 -7
  14. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
  15. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +1 -1
  16. data/app/presenters/blacklight/rendering/pipeline.rb +6 -1
  17. data/app/views/catalog/_facet_limit.html.erb +2 -2
  18. data/lib/blacklight/configuration.rb +3 -13
  19. data/lib/blacklight/search_state.rb +6 -2
  20. data/lib/blacklight/solr/response.rb +1 -1
  21. data/lib/blacklight/solr/search_builder_behavior.rb +6 -6
  22. data/lib/generators/blacklight/templates/catalog_controller.rb +2 -0
  23. data/spec/controllers/blacklight/search_helper_spec.rb +14 -0
  24. data/spec/controllers/catalog_controller_spec.rb +18 -0
  25. data/spec/helpers/deprecated_url_helper_behavior_spec.rb +1 -0
  26. data/spec/helpers/render_constraints_helper_spec.rb +1 -0
  27. data/spec/models/blacklight/solr/search_builder_spec.rb +46 -0
  28. data/spec/presenters/pipeline_spec.rb +9 -0
  29. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b010c38e55760896be7d71da9b207fd9683fd635
4
- data.tar.gz: fcafe80dfca427f26122f7a05e2e18c9825ba24b
3
+ metadata.gz: 7659ba5e00f78c03a1a4f10c0b3aa010290f3101
4
+ data.tar.gz: eff65628374ba2a260ce76c62a8e6fbcc7eea314
5
5
  SHA512:
6
- metadata.gz: ccd2af1a8f740736a05dccc542e1277de04e363dc1e50a02f9d0936592837ad62ebbad88108479d92a8807c12a81c202189d1009e801cc1000247d101bab90f9
7
- data.tar.gz: e29b7a34a42498627f67ee4575c0981e7d8b6e697f6b9a925d829bf84c1b8f57f7aa7b24d93895e0d196c6a7885b1b8dd12fc81b15abc04114644029a8556288
6
+ metadata.gz: e6fc2330aa0cd95b868358e8d4761a88a0eca3bbcc7bf3513b843983ff894f87539f289d453c55fa95122f4a0943860d8c8522969f85ea0ccd50cbeda82513cf
7
+ data.tar.gz: c176bbe0a6cbaf3c5eea74a13d644a113e7daf87750be9782303ab36081d15da334d23dff1ca6dc2a8e3885c58efd0dac1ddc419f73db63d3b7fbbec6a443ce2
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-10-31 11:13:16 -0700 using RuboCop version 0.45.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: 60
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: 193
92
+ Max: 186
89
93
 
90
94
  # Offense count: 20
91
95
  Metrics/CyclomaticComplexity:
92
96
  Max: 12
93
97
 
94
- # Offense count: 50
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:
@@ -172,7 +195,7 @@ Style/CaseIndentation:
172
195
  - 'lib/blacklight/configuration/fields.rb'
173
196
  - 'lib/blacklight/search_builder.rb'
174
197
 
175
- # Offense count: 50
198
+ # Offense count: 51
176
199
  # Configuration parameters: EnforcedStyle, SupportedStyles.
177
200
  # SupportedStyles: nested, compact
178
201
  Style/ClassAndModuleChildren:
@@ -180,13 +203,13 @@ 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:
187
210
  - 'lib/blacklight/solr/response/spelling.rb'
188
211
 
189
- # Offense count: 91
212
+ # Offense count: 104
190
213
  Style/Documentation:
191
214
  Enabled: false
192
215
 
@@ -224,10 +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
251
  - 'config/routes.rb'
230
- - 'lib/blacklight/configuration.rb'
231
252
  - 'lib/generators/blacklight/controller_generator.rb'
232
253
  - 'lib/generators/blacklight/document_generator.rb'
233
254
  - 'lib/generators/blacklight/install_generator.rb'
@@ -235,7 +256,14 @@ Style/ExtraSpacing:
235
256
  - 'lib/railties/blacklight.rake'
236
257
  - 'tasks/blacklight.rake'
237
258
 
238
- # 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
239
267
  # Configuration parameters: MinBodyLength.
240
268
  Style/GuardClause:
241
269
  Exclude:
@@ -246,14 +274,14 @@ Style/GuardClause:
246
274
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
247
275
  - 'lib/blacklight/solr/search_builder_behavior.rb'
248
276
 
249
- # Offense count: 103
277
+ # Offense count: 111
250
278
  # Cop supports --auto-correct.
251
279
  # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
252
280
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
253
281
  Style/HashSyntax:
254
282
  Enabled: false
255
283
 
256
- # Offense count: 16
284
+ # Offense count: 15
257
285
  # Cop supports --auto-correct.
258
286
  # Configuration parameters: MaxLineLength.
259
287
  Style/IfUnlessModifier:
@@ -264,7 +292,6 @@ Style/IfUnlessModifier:
264
292
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
265
293
  - 'app/helpers/blacklight/url_helper_behavior.rb'
266
294
  - 'app/models/blacklight/facet_paginator.rb'
267
- - 'lib/blacklight/configuration.rb'
268
295
  - 'lib/blacklight/configuration/fields.rb'
269
296
  - 'lib/blacklight/search_state.rb'
270
297
  - 'lib/generators/blacklight/install_generator.rb'
@@ -278,7 +305,7 @@ Style/IndentHash:
278
305
  Exclude:
279
306
  - 'lib/blacklight/configuration.rb'
280
307
 
281
- # Offense count: 20
308
+ # Offense count: 23
282
309
  # Cop supports --auto-correct.
283
310
  # Configuration parameters: Width.
284
311
  Style/IndentationWidth:
@@ -297,7 +324,7 @@ Style/IndentationWidth:
297
324
  - 'lib/blacklight/solr/search_builder_behavior.rb'
298
325
  - 'lib/generators/blacklight/assets_generator.rb'
299
326
 
300
- # Offense count: 5
327
+ # Offense count: 9
301
328
  # Cop supports --auto-correct.
302
329
  Style/LeadingCommentSpace:
303
330
  Exclude:
@@ -307,7 +334,7 @@ Style/LeadingCommentSpace:
307
334
  - 'lib/blacklight/configuration.rb'
308
335
  - 'lib/blacklight/solr/response/spelling.rb'
309
336
 
310
- # Offense count: 116
337
+ # Offense count: 125
311
338
  # Cop supports --auto-correct.
312
339
  # Configuration parameters: EnforcedStyle, SupportedStyles.
313
340
  # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
@@ -337,7 +364,7 @@ Style/MultilineMethodCallIndentation:
337
364
  - 'app/controllers/concerns/blacklight/search_helper.rb'
338
365
  - 'lib/blacklight/search_builder.rb'
339
366
 
340
- # Offense count: 13
367
+ # Offense count: 12
341
368
  # Cop supports --auto-correct.
342
369
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
343
370
  # SupportedStyles: aligned, indented
@@ -378,7 +405,7 @@ Style/PredicateName:
378
405
  Style/RedundantSelf:
379
406
  Enabled: false
380
407
 
381
- # Offense count: 16
408
+ # Offense count: 17
382
409
  # Cop supports --auto-correct.
383
410
  Style/SpaceAfterComma:
384
411
  Exclude:
@@ -387,7 +414,6 @@ Style/SpaceAfterComma:
387
414
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
388
415
  - 'app/helpers/blacklight/render_constraints_helper_behavior.rb'
389
416
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
390
- - 'lib/blacklight/configuration.rb'
391
417
  - 'lib/blacklight/configuration/fields.rb'
392
418
  - 'lib/blacklight/parameters.rb'
393
419
  - 'lib/blacklight/solr/response/facets.rb'
@@ -396,14 +422,14 @@ Style/SpaceAfterComma:
396
422
 
397
423
  # Offense count: 3
398
424
  # Cop supports --auto-correct.
399
- # Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
400
- # SupportedStyles: space, no_space
425
+ # Configuration parameters: EnforcedStyleInsidePipes, SupportedStylesInsidePipes.
426
+ # SupportedStylesInsidePipes: space, no_space
401
427
  Style/SpaceAroundBlockParameters:
402
428
  Exclude:
403
429
  - 'app/controllers/concerns/blacklight/catalog.rb'
404
430
  - 'app/models/concerns/blacklight/document/extensions.rb'
405
431
 
406
- # Offense count: 27
432
+ # Offense count: 26
407
433
  # Cop supports --auto-correct.
408
434
  # Configuration parameters: EnforcedStyle, SupportedStyles.
409
435
  # SupportedStyles: space, no_space
@@ -414,7 +440,6 @@ Style/SpaceAroundEqualsInParameterDefault:
414
440
  - 'app/helpers/blacklight/component_helper_behavior.rb'
415
441
  - 'app/helpers/blacklight/configuration_helper_behavior.rb'
416
442
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
417
- - 'app/helpers/blacklight/render_partials_helper.rb'
418
443
  - 'app/helpers/blacklight/url_helper_behavior.rb'
419
444
  - 'app/models/concerns/blacklight/document.rb'
420
445
  - 'app/presenters/blacklight/document_presenter.rb'
@@ -422,7 +447,7 @@ Style/SpaceAroundEqualsInParameterDefault:
422
447
  - 'app/presenters/blacklight/show_presenter.rb'
423
448
  - 'lib/blacklight/search_state.rb'
424
449
 
425
- # Offense count: 10
450
+ # Offense count: 11
426
451
  # Cop supports --auto-correct.
427
452
  # Configuration parameters: AllowForAlignment.
428
453
  Style/SpaceAroundOperators:
@@ -432,8 +457,6 @@ Style/SpaceAroundOperators:
432
457
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
433
458
  - 'app/helpers/blacklight/search_history_constraints_helper_behavior.rb'
434
459
  - 'app/helpers/blacklight/url_helper_behavior.rb'
435
- - 'app/models/concerns/blacklight/document/export.rb'
436
- - 'lib/blacklight/configuration.rb'
437
460
  - 'lib/blacklight/solr/repository.rb'
438
461
  - 'lib/blacklight/solr/response/spelling.rb'
439
462
  - 'tasks/blacklight.rake'
@@ -468,8 +491,9 @@ Style/SpaceBeforeFirstArg:
468
491
 
469
492
  # Offense count: 15
470
493
  # Cop supports --auto-correct.
471
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
494
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
472
495
  # SupportedStyles: space, no_space
496
+ # SupportedStylesForEmptyBraces: space, no_space
473
497
  Style/SpaceInsideBlockBraces:
474
498
  Exclude:
475
499
  - 'app/controllers/concerns/blacklight/bookmarks.rb'
@@ -488,10 +512,11 @@ Style/SpaceInsideBrackets:
488
512
  Exclude:
489
513
  - 'lib/blacklight/configuration/fields.rb'
490
514
 
491
- # Offense count: 19
515
+ # Offense count: 18
492
516
  # Cop supports --auto-correct.
493
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
517
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
494
518
  # SupportedStyles: space, no_space, compact
519
+ # SupportedStylesForEmptyBraces: space, no_space
495
520
  Style/SpaceInsideHashLiteralBraces:
496
521
  Exclude:
497
522
  - 'app/controllers/concerns/blacklight/bookmarks.rb'
@@ -503,14 +528,13 @@ Style/SpaceInsideHashLiteralBraces:
503
528
  - 'lib/blacklight/configuration.rb'
504
529
  - 'lib/blacklight/solr/repository.rb'
505
530
 
506
- # Offense count: 19
531
+ # Offense count: 18
507
532
  # Cop supports --auto-correct.
508
533
  Style/SpaceInsideParens:
509
534
  Exclude:
510
535
  - 'app/controllers/concerns/blacklight/search_context.rb'
511
536
  - 'app/helpers/blacklight/catalog_helper_behavior.rb'
512
537
  - 'app/helpers/blacklight/facets_helper_behavior.rb'
513
- - 'app/helpers/blacklight/render_constraints_helper_behavior.rb'
514
538
  - 'app/helpers/blacklight/search_history_constraints_helper_behavior.rb'
515
539
  - 'app/helpers/blacklight/url_helper_behavior.rb'
516
540
  - 'app/models/concerns/blacklight/document/dublin_core.rb'
@@ -519,8 +543,7 @@ Style/SpaceInsideParens:
519
543
  - 'lib/blacklight/search_state.rb'
520
544
  - 'lib/blacklight/solr/search_builder_behavior.rb'
521
545
 
522
- # Offense count: 190
546
+ # Offense count: 199
523
547
  # Cop supports --auto-correct.
524
548
  Style/TrailingWhitespace:
525
549
  Enabled: false
526
-
@@ -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.3
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:
@@ -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)
@@ -2,6 +2,11 @@ module Blacklight
2
2
  module Rendering
3
3
  # The field rendering pipeline
4
4
  class Pipeline
5
+ class_attribute :operations
6
+
7
+ # The ordered list of pipeline operations
8
+ self.operations = [HelperMethod, LinkToFacet, Microdata, Join]
9
+
5
10
  def initialize(values, config, document, context, options)
6
11
  @values = values
7
12
  @config = config
@@ -25,7 +30,7 @@ module Blacklight
25
30
 
26
31
  # Ordered list of operations, Terminator must be at the end.
27
32
  def stack
28
- [HelperMethod, LinkToFacet, Microdata, Join, Terminator]
33
+ operations + [Terminator]
29
34
  end
30
35
  end
31
36
  end
@@ -1,11 +1,11 @@
1
1
  <ul class="facet-values list-unstyled">
2
2
  <% paginator = facet_paginator(facet_field, display_facet) %>
3
- <%= render_facet_limit_list paginator, field_name %>
3
+ <%= render_facet_limit_list paginator, facet_field.key %>
4
4
 
5
5
  <% unless paginator.last_page? || params[:action] == "facet" %>
6
6
  <li class="more_facets_link">
7
7
  <%= link_to t("more_#{field_name}_html", scope: 'blacklight.search.facets', default: :more_html, field_name: facet_field.label),
8
- search_facet_path(id: field_name), class: "more_facets_link" %>
8
+ search_facet_path(id: facet_field.key), class: "more_facets_link" %>
9
9
  </li>
10
10
  <% end %>
11
11
  </ul>
@@ -163,18 +163,9 @@ module Blacklight
163
163
  # solr fields to use for sorting results
164
164
  define_field_access :sort_field
165
165
 
166
- def initialize(*args)
167
- super(*args)
168
- initialize_default_values!
166
+ def initialize(hash = {})
167
+ super(self.class.default_values.deep_dup.merge(hash))
169
168
  yield(self) if block_given?
170
- self
171
- end
172
-
173
- # Initialize default values from the class attribute
174
- def initialize_default_values!
175
- Marshal.load(Marshal.dump(self.class.default_values)).each do |k, v|
176
- self[k] ||= v
177
- end
178
169
  end
179
170
 
180
171
  def document_model
@@ -295,8 +286,7 @@ module Blacklight
295
286
  end
296
287
  end
297
288
 
298
- ##
299
- # Provide a 'deep copy' of Blacklight::Configuration that can be modifyed without affecting
289
+ # Provide a 'deep copy' of Blacklight::Configuration that can be modified without effecting
300
290
  # the original Blacklight::Configuration instance.
301
291
  #
302
292
  # Rails 4.x provides `#deep_dup`, but it aggressively `#dup`'s class names
@@ -32,9 +32,13 @@ module Blacklight
32
32
  alias to_h to_hash
33
33
 
34
34
  def reset
35
- Blacklight::SearchState.new(ActionController::Parameters.new, blacklight_config)
35
+ self.class.new(ActionController::Parameters.new, blacklight_config)
36
36
  end
37
37
 
38
+ ##
39
+ # Extension point for downstream applications
40
+ # to provide more interesting routing to
41
+ # documents
38
42
  def url_for_document(doc, options = {})
39
43
  if respond_to?(:blacklight_config) and
40
44
  blacklight_config.show.route and
@@ -116,7 +120,7 @@ module Blacklight
116
120
  # @yield [params] The merged parameters hash before being sanitized
117
121
  def params_for_search(params_to_merge={}, &block)
118
122
  # params hash we'll return
119
- my_params = params.dup.merge(Blacklight::SearchState.new(params_to_merge, blacklight_config))
123
+ my_params = params.dup.merge(self.class.new(params_to_merge, blacklight_config))
120
124
 
121
125
  if block_given?
122
126
  yield my_params
@@ -93,7 +93,7 @@ class Blacklight::Solr::Response < ActiveSupport::HashWithIndifferentAccess
93
93
  value.each { |v| force_to_utf8(v) }
94
94
  when String
95
95
  if value.encoding != Encoding::UTF_8
96
- Rails.logger.warn "Found a non utf-8 value in Blacklight::Solr::Response. \"#{value}\" Encoding is #{value.encoding}"
96
+ Blacklight.logger.warn "Found a non utf-8 value in Blacklight::Solr::Response. \"#{value}\" Encoding is #{value.encoding}"
97
97
  value.dup.force_encoding('UTF-8')
98
98
  else
99
99
  value
@@ -182,14 +182,14 @@ module Blacklight::Solr
182
182
 
183
183
  # Now override with our specific things for fetching facet values
184
184
  facet_ex = facet_config.respond_to?(:ex) ? facet_config.ex : nil
185
- solr_params[:"facet.field"] = with_ex_local_param(facet_ex, facet)
185
+ solr_params[:"facet.field"] = with_ex_local_param(facet_ex, facet_config.field)
186
186
 
187
187
  limit = if scope.respond_to?(:facet_list_limit)
188
188
  scope.facet_list_limit.to_s.to_i
189
189
  elsif solr_params["facet.limit"]
190
190
  solr_params["facet.limit"].to_i
191
191
  else
192
- 20
192
+ facet_config.fetch(:more_limit, 20)
193
193
  end
194
194
 
195
195
  page = blacklight_params.fetch(request_keys[:page], 1).to_i
@@ -200,13 +200,13 @@ module Blacklight::Solr
200
200
 
201
201
  # Need to set as f.facet_field.facet.* to make sure we
202
202
  # override any field-specific default in the solr request handler.
203
- solr_params[:"f.#{facet}.facet.limit"] = limit + 1
204
- solr_params[:"f.#{facet}.facet.offset"] = offset
203
+ solr_params[:"f.#{facet_config.field}.facet.limit"] = limit + 1
204
+ solr_params[:"f.#{facet_config.field}.facet.offset"] = offset
205
205
  if blacklight_params[request_keys[:sort]]
206
- solr_params[:"f.#{facet}.facet.sort"] = sort
206
+ solr_params[:"f.#{facet_config.field}.facet.sort"] = sort
207
207
  end
208
208
  if blacklight_params[request_keys[:prefix]]
209
- solr_params[:"f.#{facet}.facet.prefix"] = prefix
209
+ solr_params[:"f.#{facet_config.field}.facet.prefix"] = prefix
210
210
  end
211
211
  solr_params[:rows] = 0
212
212
  end
@@ -38,10 +38,12 @@ class <%= controller_name.classify %>Controller < ApplicationController
38
38
  # solr field configuration for search results/index views
39
39
  config.index.title_field = 'title_display'
40
40
  config.index.display_type_field = 'format'
41
+ #config.index.thumbnail_field = 'thumbnail_path_ss'
41
42
 
42
43
  # solr field configuration for document/show views
43
44
  #config.show.title_field = 'title_display'
44
45
  #config.show.display_type_field = 'format'
46
+ #config.show.thumbnail_field = 'thumbnail_path_ss'
45
47
 
46
48
  # solr fields that will be treated as facets by the blacklight application
47
49
  # The ordering of the field names is the order of the display
@@ -392,6 +392,20 @@ describe Blacklight::SearchHelper do
392
392
  expect(subject.facet_limit_for("language_facet")).to eq 10
393
393
  end
394
394
  end
395
+
396
+ context 'for facet fields with a key that is different from the field name' do
397
+ let(:blacklight_config) do
398
+ Blacklight::Configuration.new do |config|
399
+ config.add_facet_field 'some_key', field: 'x', limit: true
400
+ end
401
+ end
402
+
403
+ it 'gets the limit from the facet field in the @response' do
404
+ response = instance_double(Blacklight::Solr::Response, aggregations: { 'x' => double(limit: 16) })
405
+ subject.instance_variable_set(:@response, response)
406
+ expect(subject.facet_limit_for('some_key')).to eq 15
407
+ end
408
+ end
395
409
  end
396
410
 
397
411
  # TODO: more complex queries! phrases, offset into search results, non-latin, boosting(?)
@@ -523,6 +523,24 @@ describe CatalogController do
523
523
  expect(json["response"]["facets"]["items"].first["value"]).to eq 'Book'
524
524
  end
525
525
  end
526
+
527
+ context 'for a facet field with a key different from the underlying field name' do
528
+ before do
529
+ controller.blacklight_config.add_facet_field 'params_key', field: 'format'
530
+ end
531
+
532
+ it 'is successful' do
533
+ get :facet, params: { id: 'params_key' }
534
+
535
+ expect(response).to be_successful
536
+
537
+ expect(assigns[:facet]).to be_kind_of Blacklight::Configuration::FacetField
538
+ expect(assigns[:facet].key).to eq 'params_key'
539
+ expect(assigns[:facet].field).to eq 'format'
540
+
541
+ expect(assigns[:pagination].items.first['value']).to eq 'Book'
542
+ end
543
+ end
526
544
  end
527
545
 
528
546
  describe "#add_to_search_history" do
@@ -16,6 +16,7 @@ describe Blacklight::DeprecatedUrlHelperBehavior do
16
16
  allow(helper).to receive(:search_state).and_return(search_state)
17
17
  allow(helper).to receive(:params).and_return(params)
18
18
  allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
19
+ allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
19
20
  end
20
21
 
21
22
  describe '#params_for_search' do
@@ -70,6 +70,7 @@ describe RenderConstraintsHelper do
70
70
  let(:params) { ActionController::Parameters.new f: { 'type' => [''] } }
71
71
  before do
72
72
  allow(helper).to receive(:blacklight_config).and_return(config)
73
+ allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
73
74
  end
74
75
  subject { helper.render_constraints_filters(params) }
75
76
 
@@ -146,6 +146,21 @@ describe Blacklight::Solr::SearchBuilderBehavior do
146
146
  end
147
147
  end
148
148
 
149
+ context "facet parameters" do
150
+ let(:blacklight_config) do
151
+ Blacklight::Configuration.new.tap do |config|
152
+ config.add_facet_field key: 'param_key', field: 'solr_field', limit: 50, ex: 'other'
153
+
154
+ config.add_facet_fields_to_solr_request!
155
+ end
156
+ end
157
+
158
+ it "should use the configured solr field name in queries" do
159
+ expect(subject).to include 'f.solr_field.facet.limit': 51,
160
+ 'facet.field': ['{!ex=other}solr_field']
161
+ end
162
+ end
163
+
149
164
  describe 'for an entirely empty search' do
150
165
 
151
166
  it 'should not have a q param' do
@@ -564,6 +579,7 @@ describe Blacklight::Solr::SearchBuilderBehavior do
564
579
  config.add_facet_field 'format'
565
580
  config.add_facet_field 'format_ordered', sort: :count
566
581
  config.add_facet_field 'format_limited', limit: 5
582
+ config.add_facet_field 'format_more_limited', limit: 5, more_limit: 50
567
583
  end
568
584
  end
569
585
 
@@ -588,6 +604,36 @@ describe Blacklight::Solr::SearchBuilderBehavior do
588
604
  expect(solr_parameters[:"f.#{facet_field}.facet.offset"]).to eq 20
589
605
  end
590
606
  end
607
+
608
+ context 'for a field with a configured more_limit' do
609
+ let(:facet_field) { 'format_more_limited' }
610
+
611
+ it 'uses the more_limit configuration' do
612
+ expect(solr_parameters[:"f.#{facet_field}.facet.limit"]).to eq 51
613
+ end
614
+ end
615
+
616
+ context 'for a field with a param key different from the field name' do
617
+ let(:user_params) { { page_key => 2, 'facet.sort': 'index', 'facet.prefix': 'x' } }
618
+ let(:facet_field) { 'param_key' }
619
+
620
+ let(:blacklight_config) do
621
+ Blacklight::Configuration.new.tap do |config|
622
+ config.add_facet_field key: 'param_key', field: 'solr_field', more_limit: 50, ex: 'other'
623
+
624
+ config.add_facet_fields_to_solr_request!
625
+ end
626
+ end
627
+
628
+ it "should use the configured solr field name in queries" do
629
+ expect(solr_parameters).to include 'f.solr_field.facet.limit': 51,
630
+ 'f.solr_field.facet.offset': 50,
631
+ 'f.solr_field.facet.sort': 'index',
632
+ 'f.solr_field.facet.prefix': 'x',
633
+ 'facet.field': '{!ex=other}solr_field'
634
+ end
635
+ end
636
+
591
637
  it 'defaults limit to 20' do
592
638
  expect(solr_parameters[:"f.#{facet_field}.facet.limit"]).to eq 21
593
639
  end
@@ -6,6 +6,7 @@ describe Blacklight::Rendering::Pipeline do
6
6
  let(:context) { double }
7
7
  let(:options) { double }
8
8
  let(:presenter) { described_class.new(values, field_config, document, context, options) }
9
+
9
10
  describe "render" do
10
11
  subject { presenter.render }
11
12
  let(:values) { ['a', 'b'] }
@@ -24,4 +25,12 @@ describe Blacklight::Rendering::Pipeline do
24
25
  it { is_expected.to have_selector("span[@itemprop='some-prop']", :text => "a") }
25
26
  end
26
27
  end
28
+
29
+ describe "#operations" do
30
+ subject { described_class.operations }
31
+ it { is_expected.to eq [Blacklight::Rendering::HelperMethod,
32
+ Blacklight::Rendering::LinkToFacet,
33
+ Blacklight::Rendering::Microdata,
34
+ Blacklight::Rendering::Join] }
35
+ end
27
36
  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: 6.7.3
4
+ version: 6.8.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: 2017-01-09 00:00:00.000000000 Z
20
+ date: 2017-03-03 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails