blacklight 7.23.0.1 → 7.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_constraints.scss +1 -0
- data/app/components/blacklight/response/facet_group_component.html.erb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +2 -2
- data/lib/blacklight/engine.rb +7 -0
- data/lib/blacklight/runtime_registry.rb +1 -5
- data/lib/blacklight/search_state.rb +12 -5
- data/spec/lib/blacklight/search_state_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6488b7d6a423e0f783458e7398cce167abd6638fe4b75765dc02480ef5906394
|
4
|
+
data.tar.gz: 1670c1b8631f8c17738216a734e66046459461462d55e0056be52cb19dad8e86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560fc0c64261c3502a1ca897fdb03d8d242ad08d9619bdc528753f0a39f466f5dd147a21a89baf1779fafc6f0aa84f3f7de12ea51df502a480052686bd5b064f
|
7
|
+
data.tar.gz: 2eb309a4b911bc60dbaa44e2cb81b1c3703531a15274e8e14b3602081d7856b17b9a321307f5b1778363f63ecf6b7a581eed4f283df68b7467fbf6d7be823095
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.24.0
|
@@ -22,7 +22,7 @@
|
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<%= content_tag :div, id: @panel_id, class: 'facets-collapse collapse' do %>
|
25
|
-
<% Deprecation.silence(Blacklight::FacetsHelperBehavior) do %>
|
25
|
+
<% ::Deprecation.silence(Blacklight::FacetsHelperBehavior) do %>
|
26
26
|
<%= helpers.render_facet_partials @fields, response: @response %>
|
27
27
|
<% end %>
|
28
28
|
<% end %>
|
@@ -9,11 +9,11 @@ module Blacklight
|
|
9
9
|
def initialize(response:, html: {}, **pagination_args)
|
10
10
|
@response = response
|
11
11
|
@html_attr = { aria: { label: t('views.pagination.aria.container_label') } }.merge(html)
|
12
|
-
@pagination_args =
|
12
|
+
@pagination_args = pagination_args
|
13
13
|
end
|
14
14
|
|
15
15
|
def pagination
|
16
|
-
helpers.paginate @response, **@pagination_args
|
16
|
+
helpers.paginate @response, **Blacklight::Engine.config.blacklight.default_pagination_options, **@pagination_args
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/blacklight/engine.rb
CHANGED
@@ -52,6 +52,13 @@ module Blacklight
|
|
52
52
|
|
53
53
|
bl_global_config.facet_missing_param = '[* TO *]'
|
54
54
|
|
55
|
+
# These options are passed through to the kaminari #paginate helper
|
56
|
+
# https://www.rubydoc.info/gems/kaminari/1.2.2#helpers
|
57
|
+
bl_global_config.default_pagination_options = {
|
58
|
+
theme: 'blacklight',
|
59
|
+
outer_window: 2
|
60
|
+
}
|
61
|
+
|
55
62
|
# Anything that goes into Blacklight::Engine.config is stored as a class
|
56
63
|
# variable on Railtie::Configuration. we're going to encapsulate all the
|
57
64
|
# Blacklight specific stuff in this single struct:
|
@@ -1,11 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_support/per_thread_registry'
|
4
|
-
|
5
3
|
module Blacklight
|
6
4
|
class RuntimeRegistry
|
7
|
-
|
8
|
-
|
9
|
-
attr_accessor :connection, :connection_config
|
5
|
+
thread_mattr_accessor :connection, :connection_config
|
10
6
|
end
|
11
7
|
end
|
@@ -42,11 +42,8 @@ module Blacklight
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# Normalize facet parameters mangled by facebook
|
45
|
-
|
46
|
-
|
47
|
-
value.is_a?(Hash) ? value.values : value
|
48
|
-
end
|
49
|
-
end
|
45
|
+
params[:f] = normalize_facet_params(params[:f]) if facet_params_need_normalization(params[:f])
|
46
|
+
params[:f_inclusive] = normalize_facet_params(params[:f_inclusive]) if facet_params_need_normalization(params[:f_inclusive])
|
50
47
|
|
51
48
|
params
|
52
49
|
end
|
@@ -251,6 +248,16 @@ module Blacklight
|
|
251
248
|
params[facet_request_keys[:prefix]]
|
252
249
|
end
|
253
250
|
|
251
|
+
def self.facet_params_need_normalization(facet_params)
|
252
|
+
facet_params.is_a?(Hash) && facet_params.values.any? { |x| x.is_a?(Hash) }
|
253
|
+
end
|
254
|
+
|
255
|
+
def self.normalize_facet_params(facet_params)
|
256
|
+
facet_params.transform_values do |value|
|
257
|
+
value.is_a?(Hash) ? value.values : value
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
254
261
|
private
|
255
262
|
|
256
263
|
def search_field_key
|
@@ -50,10 +50,14 @@ RSpec.describe Blacklight::SearchState do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
context 'with facebooks badly mangled query parameters' do
|
53
|
-
let(:params)
|
53
|
+
let(:params) do
|
54
|
+
{ f: { field: { '0': 'first', '1': 'second' } },
|
55
|
+
f_inclusive: { field: { '0': 'first', '1': 'second' } } }
|
56
|
+
end
|
54
57
|
|
55
58
|
it 'normalizes the facets to the expected format' do
|
56
59
|
expect(search_state.to_h).to include f: { field: %w[first second] }
|
60
|
+
expect(search_state.to_h).to include f_inclusive: { field: %w[first second] }
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
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: 7.
|
4
|
+
version: 7.24.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: 2022-
|
20
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|