blacklight 8.8.2 → 8.8.4
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/components/blacklight/document/action_component.rb +1 -3
- data/app/components/blacklight/facet_field_component.html.erb +1 -1
- data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/presenters/blacklight/json_presenter.rb +1 -3
- data/lib/blacklight/search_state/filter_field.rb +2 -2
- data/package.json +1 -1
- data/spec/components/blacklight/system/dropdown_component_spec.rb +26 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/facets_spec.rb +7 -0
- data/spec/lib/blacklight/parameters_spec.rb +12 -1
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +18 -0
- data/spec/services/blacklight/search_service_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d197e1d545d7d874d39770d590fa4981a841c9143e2b14bfaeec95bbc449b914
|
4
|
+
data.tar.gz: 7a37f82fa0be835b5d9d01dbcd66f620e26a8a3143cf327a626725c8f3865a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80bcd51b40f30b48e1774975ee5701a1ab6a825455a4a4796b27023a12faf7aa0be12f86da6448d914e100b85573b3a9cfca06bec4c250922148754674fddc78
|
7
|
+
data.tar.gz: 7662c623c9654f640a116b4fb6f7233ce5216ebf9c8ed964c0bbc31f165f43133167faeaba61ca935614ebe800ac0fbff0426b6f89d88294e53cf93aecf704e5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.8.
|
1
|
+
8.8.4
|
@@ -6,7 +6,7 @@ module Blacklight
|
|
6
6
|
renders_one :button, DropdownButtonComponent
|
7
7
|
|
8
8
|
renders_many :options, (lambda do |text:, url:, selected: false|
|
9
|
-
link_to(text, url, class: "dropdown-item #{'active' if selected}",
|
9
|
+
link_to(text, url, class: "dropdown-item #{'active' if selected}", aria: { current: ('page' if selected) })
|
10
10
|
end)
|
11
11
|
|
12
12
|
# rubocop:disable Metrics/ParameterLists
|
@@ -13,9 +13,7 @@ module Blacklight
|
|
13
13
|
|
14
14
|
delegate :facet_field_names, :facet_configuration_for_field, to: :blacklight_config
|
15
15
|
|
16
|
-
|
17
|
-
@response.documents
|
18
|
-
end
|
16
|
+
delegate :documents, to: :@response
|
19
17
|
|
20
18
|
# @return [Array<Blacklight::Solr::Response::Facets::FacetField>]
|
21
19
|
def search_facets
|
@@ -145,8 +145,8 @@ module Blacklight
|
|
145
145
|
def permitted_params
|
146
146
|
if config.pivot
|
147
147
|
{
|
148
|
-
filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => [], "-#{key}" => []) },
|
149
|
-
inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => []) }
|
148
|
+
filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => [], "-#{key}" => []) },
|
149
|
+
inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => []) }
|
150
150
|
}
|
151
151
|
else
|
152
152
|
{
|
data/package.json
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Blacklight::System::DropdownComponent, type: :component do
|
6
|
+
it 'includes a link for each choice' do
|
7
|
+
search_state = double(Blacklight::SearchState)
|
8
|
+
allow(search_state).to receive(:params_for_search).and_return('http://example.com')
|
9
|
+
rendered = render_inline(described_class.new(
|
10
|
+
param: :per_page,
|
11
|
+
choices: [
|
12
|
+
['10 per page', 10],
|
13
|
+
['20 per page', 20]
|
14
|
+
],
|
15
|
+
search_state: search_state,
|
16
|
+
selected: 20,
|
17
|
+
interpolation: :count
|
18
|
+
))
|
19
|
+
|
20
|
+
expect(rendered.css('a').length).to eq 2
|
21
|
+
expect(rendered.css('a')[0].text).to eq '10 per page'
|
22
|
+
expect(rendered.css('a')[0].attributes).not_to have_key 'aria-current'
|
23
|
+
expect(rendered.css('a')[1].text).to eq '20 per page'
|
24
|
+
expect(rendered.css('a')[1].attributes).to have_key 'aria-current'
|
25
|
+
end
|
26
|
+
end
|
@@ -803,7 +803,7 @@ RSpec.describe CatalogController, :api do
|
|
803
803
|
end
|
804
804
|
|
805
805
|
it "is empty for empty result sets", :integration do
|
806
|
-
get :page_links, params: { f: { "format" => 'empty-result-set' }, counter: 1 }
|
806
|
+
get :page_links, params: { f: { "format" => ['empty-result-set'] }, counter: 1 }
|
807
807
|
expect(assigns(:page_link_data)).to be_empty
|
808
808
|
end
|
809
809
|
end
|
@@ -138,4 +138,11 @@ RSpec.describe "Facets" do
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
describe 'facebook-style facet parameters' do
|
143
|
+
it 'can perform a search' do
|
144
|
+
visit '/?f[subject_ssim][0]=Iran.+Viza%CC%84rat-i+Kishvar'
|
145
|
+
expect(page).to have_text 'Naqdī barā-yi tamām-i fuṣūl'
|
146
|
+
end
|
147
|
+
end
|
141
148
|
end
|
@@ -52,7 +52,7 @@ RSpec.describe Blacklight::Parameters do
|
|
52
52
|
let(:search_state) { Blacklight::SearchState.new(query_params, blacklight_config) }
|
53
53
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
54
54
|
|
55
|
-
context 'with
|
55
|
+
context 'with facebook\'s badly mangled query parameters' do
|
56
56
|
let(:query_params) do
|
57
57
|
ActionController::Parameters.new(
|
58
58
|
f: { field: { '0': 'first', '1': 'second' } },
|
@@ -67,6 +67,17 @@ RSpec.describe Blacklight::Parameters do
|
|
67
67
|
it 'normalizes the facets to the expected format' do
|
68
68
|
expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
|
69
69
|
end
|
70
|
+
|
71
|
+
context 'when several fields are configured' do
|
72
|
+
before do
|
73
|
+
blacklight_config.add_facet_field 'other_field'
|
74
|
+
blacklight_config.add_facet_field 'some_other_pivot_field', pivot: %w[abc def]
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'normalizes the facets to the expected format' do
|
78
|
+
expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
|
79
|
+
end
|
80
|
+
end
|
70
81
|
end
|
71
82
|
|
72
83
|
context 'with filter_search_state_fields set to false' do
|
@@ -198,4 +198,22 @@ RSpec.describe Blacklight::SearchState::FilterField do
|
|
198
198
|
expect(search_state.filter('some_field').include?(OpenStruct.new(value: '1'))).to be true
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
describe '#permitted_params' do
|
203
|
+
context 'with a pivot facet' do
|
204
|
+
let(:blacklight_config) do
|
205
|
+
Blacklight::Configuration.new.configure do |config|
|
206
|
+
config.add_facet_field 'my_pivot', pivot: %w[format language_ssim]
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'marks all the pivot fields as permitted' do
|
211
|
+
field = described_class.new blacklight_config.facet_fields['my_pivot'], search_state
|
212
|
+
expect(field.permitted_params).to eq({
|
213
|
+
f: { "-format" => [], "-language_ssim" => [], "format" => [], "language_ssim" => [] },
|
214
|
+
f_inclusive: { "format" => [], "language_ssim" => [] }
|
215
|
+
})
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
201
219
|
end
|
@@ -59,7 +59,7 @@ RSpec.describe Blacklight::SearchService, :api do
|
|
59
59
|
allow(blacklight_config).to receive(:default_solr_params).and_return(qt: 'custom_request_handler')
|
60
60
|
allow(blacklight_solr).to receive(:send_and_receive) do |path, params|
|
61
61
|
expect(path).to eq 'select'
|
62
|
-
expect(params[:params]['facet.field']).to
|
62
|
+
expect(params[:params]['facet.field']).to contain_exactly "format", "{!ex=pub_date_ssim_single}pub_date_ssim", "subject_ssim", "language_ssim", "lc_1letter_ssim", "subject_geo_ssim", "subject_era_ssim"
|
63
63
|
expect(params[:params]["facet.query"]).to eq ["pub_date_ssim:[#{5.years.ago.year} TO *]", "pub_date_ssim:[#{10.years.ago.year} TO *]", "pub_date_ssim:[#{25.years.ago.year} TO *]"]
|
64
64
|
expect(params[:params]).to include('rows' => 10, 'qt' => "custom_request_handler", 'q' => "", "f.subject_ssim.facet.limit" => 21, 'sort' => "score desc, pub_date_si desc, title_si asc")
|
65
65
|
end.and_return('response' => { 'docs' => [] })
|
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: 8.8.
|
4
|
+
version: 8.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
- Justin Coyne
|
17
17
|
bindir: exe
|
18
18
|
cert_chain: []
|
19
|
-
date: 2025-
|
19
|
+
date: 2025-03-07 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rails
|
@@ -869,6 +869,7 @@ files:
|
|
869
869
|
- spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
|
870
870
|
- spec/components/blacklight/skip_link_component_spec.rb
|
871
871
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
872
|
+
- spec/components/blacklight/system/dropdown_component_spec.rb
|
872
873
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
873
874
|
- spec/controllers/alternate_controller_spec.rb
|
874
875
|
- spec/controllers/application_controller_spec.rb
|
@@ -1051,6 +1052,7 @@ test_files:
|
|
1051
1052
|
- spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
|
1052
1053
|
- spec/components/blacklight/skip_link_component_spec.rb
|
1053
1054
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
1055
|
+
- spec/components/blacklight/system/dropdown_component_spec.rb
|
1054
1056
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
1055
1057
|
- spec/controllers/alternate_controller_spec.rb
|
1056
1058
|
- spec/controllers/application_controller_spec.rb
|