blacklight 7.28.0 → 7.29.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_group.scss +2 -2
- data/app/components/blacklight/facet_component.rb +5 -6
- data/app/views/catalog/index.json.jbuilder +10 -8
- data/lib/blacklight/search_builder.rb +1 -1
- data/spec/components/blacklight/facet_component_spec.rb +19 -0
- 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: 752a397403b186b177e51a6f260f7f385d9e1db6c26abdb9b37c9c25ecf2ad04
|
4
|
+
data.tar.gz: f81dc90a28f7c9d9cecc35f60e119bd09ec96bd12584b8f1ffb39e51845a0588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c453918cd5521dd2ee24df0d7d874c48705d14422f8746a10bd262681e411ed54efef1202f9785beec20169ca5ca9acd4d648e730df8a930d2aa659190d905
|
7
|
+
data.tar.gz: 8014988552c75ebb9bbbd82dcad688dfcd3ea2b6126b63c4c178ab32fe034787bdd61b75a826ecdb1c9022e148a7f9911eb99e7c35090de9361d434756fb85a1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.29.0
|
@@ -11,8 +11,8 @@ module Blacklight
|
|
11
11
|
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
12
12
|
# @param [Blacklight::Configuration] blacklight_config
|
13
13
|
# @param [Boolean] layout
|
14
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
15
|
-
def initialize(display_facet_or_field_config: nil, display_facet: nil, field_config: nil, response: nil, blacklight_config: nil, **component_args)
|
14
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists
|
15
|
+
def initialize(display_facet_or_field_config: nil, display_facet: nil, field_config: nil, response: nil, blacklight_config: nil, component: nil, **component_args)
|
16
16
|
if display_facet_or_field_config.is_a? Blacklight::FacetFieldPresenter
|
17
17
|
@facet_field_presenter = display_facet_or_field_config
|
18
18
|
@field_config = @facet_field_presenter.facet_field
|
@@ -30,9 +30,10 @@ module Blacklight
|
|
30
30
|
raise ArgumentError, 'You must provide one of display_facet or field_config' unless @field_config
|
31
31
|
end
|
32
32
|
|
33
|
+
@component = component || (@field_config.component == true ? Blacklight::FacetFieldListComponent : @field_config.component)
|
33
34
|
@component_args = component_args
|
34
35
|
end
|
35
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
36
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/ParameterLists
|
36
37
|
|
37
38
|
def render?
|
38
39
|
helpers.should_render_field?(@field_config, @display_facet)
|
@@ -41,10 +42,8 @@ module Blacklight
|
|
41
42
|
def call
|
42
43
|
return render_partial if @field_config.partial
|
43
44
|
|
44
|
-
component = @field_config.component == true ? Blacklight::FacetFieldListComponent : @field_config.component
|
45
|
-
|
46
45
|
render(
|
47
|
-
component.new(
|
46
|
+
@component.new(
|
48
47
|
facet_field: @facet_field_presenter || helpers.facet_field_presenter(@field_config, @display_facet),
|
49
48
|
**@component_args
|
50
49
|
)
|
@@ -67,14 +67,16 @@ json.included do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
json.
|
72
|
-
|
73
|
-
|
74
|
-
json.
|
75
|
-
|
76
|
-
|
77
|
-
json.
|
70
|
+
Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
|
71
|
+
json.array! search_fields do |(label, key)|
|
72
|
+
json.type 'search_field'
|
73
|
+
json.id key
|
74
|
+
json.attributes do
|
75
|
+
json.label label
|
76
|
+
end
|
77
|
+
json.links do
|
78
|
+
json.self url_for(search_state.to_h.merge(search_field: key, only_path: false))
|
79
|
+
end
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -27,7 +27,7 @@ module Blacklight
|
|
27
27
|
end
|
28
28
|
|
29
29
|
@blacklight_params = {}
|
30
|
-
search_state_class = @scope
|
30
|
+
search_state_class = @scope.try(:search_state_class) || Blacklight::SearchState
|
31
31
|
@search_state = search_state_class.new(@blacklight_params, @scope&.blacklight_config, @scope)
|
32
32
|
@additional_filters = {}
|
33
33
|
@merged_params = {}
|
@@ -26,6 +26,25 @@ RSpec.describe Blacklight::FacetComponent, type: :component do
|
|
26
26
|
expect(rendered).to have_selector 'ul.facet-values'
|
27
27
|
end
|
28
28
|
|
29
|
+
context 'with a provided component' do
|
30
|
+
let(:component_kwargs) { { field_config: facet_config, display_facet: display_facet, component: component_class } }
|
31
|
+
let(:component_class) do
|
32
|
+
Class.new(Blacklight::FacetFieldListComponent) do
|
33
|
+
def self.name
|
34
|
+
'CustomFacetComponent'
|
35
|
+
end
|
36
|
+
|
37
|
+
def call
|
38
|
+
'Custom facet rendering'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'renders the provided component' do
|
44
|
+
expect(rendered).to have_content 'Custom facet rendering'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
29
48
|
context 'with a facet configured to use a partial' do
|
30
49
|
let(:facet_config) do
|
31
50
|
Blacklight::Configuration::FacetField.new(key: 'field', partial: 'catalog/facet_partial').normalize!
|
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.29.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-07-
|
20
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|