blacklight 7.17.2 → 7.19.2
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/javascripts/blacklight/blacklight.js +1 -2
- data/app/assets/stylesheets/blacklight/_balanced_list.scss +2 -2
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +1 -1
- data/app/assets/stylesheets/blacklight/_constraints.scss +2 -2
- data/app/assets/stylesheets/blacklight/_controls.scss +2 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +3 -1
- data/app/assets/stylesheets/blacklight/_header.scss +6 -1
- data/app/components/blacklight/constraint_layout_component.html.erb +1 -1
- data/app/components/blacklight/constraints_component.html.erb +2 -2
- data/app/components/blacklight/content_areas_shim.rb +2 -1
- data/app/components/blacklight/document/thumbnail_component.html.erb +3 -3
- data/app/components/blacklight/document/thumbnail_component.rb +11 -3
- data/app/components/blacklight/document_component.rb +7 -7
- data/app/components/blacklight/facet_field_component.html.erb +3 -1
- data/app/components/blacklight/facet_field_no_layout_component.rb +1 -1
- data/app/components/blacklight/facet_item_component.rb +2 -2
- data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
- data/app/components/blacklight/metadata_field_layout_component.rb +1 -1
- data/app/components/blacklight/response/facet_group_component.html.erb +2 -0
- data/app/components/blacklight/response/view_type_component.html.erb +1 -1
- data/app/components/blacklight/search_bar_component.html.erb +3 -3
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
- data/app/components/blacklight/system/modal_component.html.erb +1 -1
- data/app/helpers/blacklight/component_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +5 -1
- data/app/javascript/blacklight/modal.js +1 -1
- data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
- data/app/views/bookmarks/index.html.erb +1 -1
- data/app/views/catalog/_constraints.html.erb +2 -2
- data/app/views/catalog/_document.html.erb +4 -3
- data/app/views/catalog/_document_list.html.erb +3 -2
- data/app/views/catalog/_home_text.html.erb +1 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +2 -2
- data/app/views/search_history/index.html.erb +1 -1
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/config/locales/blacklight.ar.yml +2 -2
- data/config/locales/blacklight.ca.yml +2 -2
- data/config/locales/blacklight.de.yml +2 -2
- data/config/locales/blacklight.en.yml +2 -2
- data/config/locales/blacklight.es.yml +2 -2
- data/config/locales/blacklight.fr.yml +2 -2
- data/config/locales/blacklight.hu.yml +2 -2
- data/config/locales/blacklight.it.yml +2 -2
- data/config/locales/blacklight.nl.yml +2 -2
- data/config/locales/blacklight.pt-BR.yml +1 -1
- data/config/locales/blacklight.sq.yml +2 -2
- data/config/locales/blacklight.zh.yml +2 -2
- data/lib/blacklight/configuration.rb +7 -1
- data/lib/blacklight/configuration/view_config.rb +3 -1
- data/lib/blacklight/nested_open_struct_with_hash_access.rb +33 -14
- data/lib/blacklight/open_struct_with_hash_access.rb +1 -1
- data/lib/blacklight/search_builder.rb +1 -0
- data/lib/blacklight/solr/request.rb +10 -7
- data/lib/blacklight/solr/search_builder_behavior.rb +28 -16
- data/lib/generators/blacklight/install_generator.rb +5 -5
- data/lib/generators/blacklight/solr_generator.rb +4 -2
- data/lib/generators/blacklight/user_generator.rb +4 -2
- data/spec/components/blacklight/constraint_layout_component_spec.rb +3 -7
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +3 -7
- data/spec/components/blacklight/facet_field_list_component_spec.rb +3 -7
- data/spec/components/blacklight/facet_item_component_spec.rb +2 -6
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +3 -7
- data/spec/components/blacklight/hidden_search_state_component_spec.rb +7 -8
- data/spec/components/blacklight/metadata_field_component_spec.rb +4 -8
- data/spec/features/facets_spec.rb +2 -2
- data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +9 -10
- data/spec/helpers/blacklight_helper_spec.rb +20 -2
- data/spec/helpers/catalog_helper_spec.rb +1 -1
- data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +36 -0
- data/spec/models/blacklight/configuration_spec.rb +10 -0
- data/spec/models/blacklight/solr/request_spec.rb +0 -1
- data/spec/models/blacklight/solr/search_builder_spec.rb +23 -1
- data/spec/services/blacklight/search_service_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/view_component_capybara_test_helpers.rb +8 -0
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_document.html.erb_spec.rb +9 -0
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +5 -5
- metadata +4 -2
|
@@ -621,4 +621,14 @@ RSpec.describe "Blacklight::Configuration", api: true do
|
|
|
621
621
|
end
|
|
622
622
|
end
|
|
623
623
|
end
|
|
624
|
+
|
|
625
|
+
describe '#freeze' do
|
|
626
|
+
it 'freezes the configuration' do
|
|
627
|
+
config.freeze
|
|
628
|
+
|
|
629
|
+
expect(config.a).to be_nil
|
|
630
|
+
expect { config.a = '123' }.to raise_error(FrozenError)
|
|
631
|
+
expect { config.view.a = '123' }.to raise_error(FrozenError)
|
|
632
|
+
end
|
|
633
|
+
end
|
|
624
634
|
end
|
|
@@ -29,6 +29,20 @@ RSpec.describe Blacklight::Solr::SearchBuilderBehavior, api: true do
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
context 'with merged parameters from the defaults + the search field' do
|
|
33
|
+
before do
|
|
34
|
+
blacklight_config.default_solr_params = { json: { whatever: [1, 2, 3] } }
|
|
35
|
+
blacklight_config.search_fields['all_fields'].solr_parameters = { json: { and_also: [4, 5, 6] } }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
let(:user_params) { { search_field: 'all_fields' } }
|
|
39
|
+
|
|
40
|
+
it 'deep merges hash values' do
|
|
41
|
+
expect(subject.to_hash.dig(:json, :whatever)).to eq [1, 2, 3]
|
|
42
|
+
expect(subject.to_hash.dig(:json, :and_also)).to eq [4, 5, 6]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
32
46
|
context "with a complex parameter environment" do
|
|
33
47
|
subject { search_builder.with(user_params).processed_parameters }
|
|
34
48
|
|
|
@@ -304,7 +318,6 @@ RSpec.describe Blacklight::Solr::SearchBuilderBehavior, api: true do
|
|
|
304
318
|
|
|
305
319
|
it "does not include weird keys not in field definition" do
|
|
306
320
|
expect(subject[:phrase_filters]).to be_nil
|
|
307
|
-
expect(subject[:fq]).to eq []
|
|
308
321
|
expect(subject[:commit]).to be_nil
|
|
309
322
|
expect(subject[:action]).to be_nil
|
|
310
323
|
expect(subject[:controller]).to be_nil
|
|
@@ -800,4 +813,13 @@ RSpec.describe Blacklight::Solr::SearchBuilderBehavior, api: true do
|
|
|
800
813
|
expect(subject.to_hash.with_indifferent_access.dig(:json, :query, :bool, :must, 1, :edismax, :qf)).to eq '${author_qf}'
|
|
801
814
|
end
|
|
802
815
|
end
|
|
816
|
+
|
|
817
|
+
describe '#where' do
|
|
818
|
+
let(:user_params) { {} }
|
|
819
|
+
|
|
820
|
+
it 'adds additional query filters on the search' do
|
|
821
|
+
subject.where(id: [1, 2, 3])
|
|
822
|
+
expect(subject.to_hash).to include q: '{!lucene}id:(1 OR 2 OR 3)'
|
|
823
|
+
end
|
|
824
|
+
end
|
|
803
825
|
end
|
|
@@ -477,7 +477,7 @@ RSpec.describe Blacklight::SearchService, api: true do
|
|
|
477
477
|
end
|
|
478
478
|
|
|
479
479
|
before do
|
|
480
|
-
blacklight_config.view.opensearch
|
|
480
|
+
blacklight_config.view.opensearch(title_field: :field)
|
|
481
481
|
allow(repository).to receive(:search).and_return(mock_response)
|
|
482
482
|
end
|
|
483
483
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -62,6 +62,7 @@ RSpec.configure do |config|
|
|
|
62
62
|
config.infer_spec_type_from_file_location!
|
|
63
63
|
config.include PresenterTestHelpers, type: :presenter
|
|
64
64
|
config.include ViewComponent::TestHelpers, type: :component
|
|
65
|
+
config.include ViewComponentCapybaraTestHelpers, type: :component
|
|
65
66
|
|
|
66
67
|
config.include(ControllerLevelHelpers, type: :helper)
|
|
67
68
|
config.before(:each, type: :helper) { initialize_controller_helpers(helper) }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ViewComponentCapybaraTestHelpers
|
|
4
|
+
# Work around for https://github.com/teamcapybara/capybara/issues/2466
|
|
5
|
+
def render_inline_to_capybara_node(component)
|
|
6
|
+
Capybara::Node::Simple.new(render_inline(component).to_s)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -46,4 +46,13 @@ RSpec.describe "catalog/_document" do
|
|
|
46
46
|
expect(rendered).to have_selector 'article.document header', text: '22. xyz'
|
|
47
47
|
expect(rendered).not_to match(/partial/)
|
|
48
48
|
end
|
|
49
|
+
|
|
50
|
+
it 'renders the partial using a provided view config' do
|
|
51
|
+
view_config = Blacklight::Configuration::ViewConfig.new partials: %w[a]
|
|
52
|
+
stub_template "catalog/_a_default.html.erb" => "partial"
|
|
53
|
+
|
|
54
|
+
render partial: "catalog/document", locals: { document: document, document_counter: 1, view_config: view_config }
|
|
55
|
+
|
|
56
|
+
expect(rendered).to match(/partial/)
|
|
57
|
+
end
|
|
49
58
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe "catalog/_document_list", type: :view do
|
|
4
4
|
before do
|
|
5
|
-
allow(view).to receive_messages(document_index_view_type: "some-view", documents: [])
|
|
5
|
+
allow(view).to receive_messages(document_index_view_type: "some-view", documents: [], blacklight_config: nil)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it "includes a class for the current view" do
|
|
@@ -27,14 +27,14 @@ RSpec.describe "catalog/facet_layout" do
|
|
|
27
27
|
|
|
28
28
|
it "is collapsable" do
|
|
29
29
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
|
30
|
-
expect(rendered).to have_selector 'button.collapsed[data-toggle="collapse"][aria-expanded="false"]'
|
|
30
|
+
expect(rendered).to have_selector 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
|
|
31
31
|
expect(rendered).to have_selector '.collapse .card-body'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "is configured to be open by default" do
|
|
35
35
|
allow(facet_field).to receive_messages(collapse: false)
|
|
36
36
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
|
37
|
-
expect(rendered).to have_selector 'button[data-toggle="collapse"][aria-expanded="true"]'
|
|
37
|
+
expect(rendered).to have_selector 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
|
|
38
38
|
expect(rendered).not_to have_selector '.card-header.collapsed'
|
|
39
39
|
expect(rendered).to have_selector '.collapse.show .card-body'
|
|
40
40
|
end
|
|
@@ -20,9 +20,9 @@ RSpec.describe "catalog/_view_type_group" do
|
|
|
20
20
|
it "displays the group" do
|
|
21
21
|
blacklight_config.configure do |config|
|
|
22
22
|
config.view.delete(:list)
|
|
23
|
-
config.view.a
|
|
24
|
-
config.view.b
|
|
25
|
-
config.view.c
|
|
23
|
+
config.view.a(icon: :list)
|
|
24
|
+
config.view.b(icon: :list)
|
|
25
|
+
config.view.c(icon: :list)
|
|
26
26
|
end
|
|
27
27
|
render partial: 'catalog/view_type_group'
|
|
28
28
|
expect(rendered).to have_selector('.btn-group.view-type-group')
|
|
@@ -37,8 +37,8 @@ RSpec.describe "catalog/_view_type_group" do
|
|
|
37
37
|
it "sets the current view to 'active'" do
|
|
38
38
|
blacklight_config.configure do |config|
|
|
39
39
|
config.view.delete(:list)
|
|
40
|
-
config.view.a
|
|
41
|
-
config.view.b
|
|
40
|
+
config.view.a(icon: :list)
|
|
41
|
+
config.view.b(icon: :list)
|
|
42
42
|
end
|
|
43
43
|
render partial: 'catalog/view_type_group'
|
|
44
44
|
expect(rendered).to have_selector('.active', text: 'a')
|
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.19.2
|
|
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: 2021-
|
|
20
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
23
23
|
name: rails
|
|
@@ -849,6 +849,7 @@ files:
|
|
|
849
849
|
- spec/support/features.rb
|
|
850
850
|
- spec/support/features/session_helpers.rb
|
|
851
851
|
- spec/support/presenter_test_helpers.rb
|
|
852
|
+
- spec/support/view_component_capybara_test_helpers.rb
|
|
852
853
|
- spec/test_app_templates/Gemfile.extra
|
|
853
854
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
|
854
855
|
- spec/views/catalog/_constraints.html.erb_spec.rb
|
|
@@ -1020,6 +1021,7 @@ test_files:
|
|
|
1020
1021
|
- spec/support/features.rb
|
|
1021
1022
|
- spec/support/features/session_helpers.rb
|
|
1022
1023
|
- spec/support/presenter_test_helpers.rb
|
|
1024
|
+
- spec/support/view_component_capybara_test_helpers.rb
|
|
1023
1025
|
- spec/test_app_templates/Gemfile.extra
|
|
1024
1026
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
|
1025
1027
|
- spec/views/catalog/_constraints.html.erb_spec.rb
|