blacklight 9.0.0.beta3 → 9.0.0.beta5
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/.rubocop_todo.yml +24 -25
- data/VERSION +1 -1
- data/app/assets/builds/blacklight.css +34 -20
- data/app/assets/javascripts/blacklight/blacklight.esm.js +4 -4
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +4 -4
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +35 -27
- data/app/components/blacklight/advanced_search_form_component.html.erb +4 -4
- data/app/components/blacklight/advanced_search_form_component.rb +2 -2
- data/app/components/blacklight/document/bookmark_component.html.erb +1 -1
- data/app/components/blacklight/document/bookmark_component.rb +9 -3
- data/app/components/blacklight/document/group_component.html.erb +1 -1
- data/app/components/blacklight/facet_item_pivot_component.rb +3 -3
- data/app/components/blacklight/facets/checkboxes_component.html.erb +4 -4
- data/app/components/blacklight/facets/field_component.html.erb +0 -2
- data/app/components/blacklight/facets/list_component.html.erb +2 -2
- data/app/components/blacklight/facets/list_component.rb +7 -2
- data/app/components/blacklight/facets/pivot_list_component.rb +14 -0
- data/app/components/blacklight/facets/suggest_component.html.erb +1 -1
- data/app/components/blacklight/search_bar_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +10 -0
- data/app/controllers/concerns/blacklight/catalog.rb +6 -1
- data/app/javascript/blacklight-frontend/button_focus.js +1 -1
- data/app/javascript/blacklight-frontend/checkbox_submit.js +1 -1
- data/app/javascript/blacklight-frontend/modal.js +2 -2
- data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
- data/app/views/catalog/_email_form.html.erb +4 -4
- data/app/views/catalog/_sms_form.html.erb +4 -4
- data/app/views/catalog/advanced_search.html.erb +1 -1
- data/app/views/layouts/blacklight/base.html.erb +1 -1
- data/config/locales/blacklight.it.yml +1 -1
- data/lib/blacklight/configuration/facet_field.rb +1 -0
- data/lib/blacklight/search_state.rb +2 -0
- data/lib/blacklight.rb +1 -1
- data/lib/generators/blacklight/templates/catalog_controller.rb +3 -1
- data/package.json +1 -1
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +1 -1
- data/spec/components/blacklight/facets/list_component_spec.rb +5 -0
- data/spec/components/blacklight/facets/pivot_list_component_spec.rb +47 -0
- data/spec/features/advanced_search_spec.rb +3 -1
- data/spec/features/facets_spec.rb +5 -5
- data/spec/features/search_filters_spec.rb +3 -1
- metadata +6 -4
- data/app/views/catalog/_facet_pivot.html.erb +0 -3
@@ -5,16 +5,16 @@
|
|
5
5
|
method: :post do %>
|
6
6
|
<div class="modal-body">
|
7
7
|
<%= render '/shared/flash_msg' %>
|
8
|
-
<div class="
|
9
|
-
<label class="
|
8
|
+
<div class="row">
|
9
|
+
<label class="col-form-label col-sm-2" for="to">
|
10
10
|
<%= t('blacklight.sms.form.to') %>
|
11
11
|
</label>
|
12
12
|
<div class="col-sm-10">
|
13
13
|
<%= telephone_field_tag :to, params[:to], class: 'form-control', required: true %>
|
14
14
|
</div>
|
15
15
|
</div>
|
16
|
-
<div class="
|
17
|
-
<label class="
|
16
|
+
<div class="row">
|
17
|
+
<label class="col-form-label col-sm-2" for="carrier">
|
18
18
|
<%= t('blacklight.sms.form.carrier') %>
|
19
19
|
</label>
|
20
20
|
<div class="col-sm-10">
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<main id="main-container" class="<%= container_classes %>" aria-label="<%= t('blacklight.main.aria.main_container') %>">
|
33
33
|
<%= content_for(:container_header) %>
|
34
34
|
|
35
|
-
<%= render
|
35
|
+
<%= render 'shared/flash_msg', layout: 'shared/flash_messages' if flash.any? %>
|
36
36
|
|
37
37
|
<div class="row">
|
38
38
|
<%= content_for?(:content) ? yield(:content) : yield %>
|
@@ -95,6 +95,7 @@ module Blacklight
|
|
95
95
|
def normalize_pivot_config!
|
96
96
|
self.item_presenter ||= Blacklight::FacetItemPivotPresenter
|
97
97
|
self.item_component ||= Blacklight::FacetItemPivotComponent
|
98
|
+
self.component ||= Blacklight::Facets::PivotListComponent
|
98
99
|
self.filter_class ||= Blacklight::SearchState::PivotFilterField
|
99
100
|
self.filter_query_builder ||= Blacklight::SearchState::PivotFilterField::QueryBuilder
|
100
101
|
end
|
@@ -82,6 +82,8 @@ module Blacklight
|
|
82
82
|
blacklight_config.facet_fields.each_value.map { |value| filter(value) }
|
83
83
|
end
|
84
84
|
|
85
|
+
# Return the list of filters (i.e. facets) that have been applied in the current search
|
86
|
+
# @return [Array<FilterField>]
|
85
87
|
def filters
|
86
88
|
@filters ||= filter_fields.select(&:any?)
|
87
89
|
end
|
data/lib/blacklight.rb
CHANGED
@@ -33,7 +33,7 @@ module Blacklight
|
|
33
33
|
raise "The value for :adapter was not found in the blacklight.yml config"
|
34
34
|
end
|
35
35
|
|
36
|
-
case connection_config&.fetch(:adapter) || 'solr'
|
36
|
+
case connection_config&.fetch(:adapter) || 'solr'
|
37
37
|
when 'solr'
|
38
38
|
Blacklight::Solr::Repository
|
39
39
|
when /::/
|
@@ -119,7 +119,9 @@ class <%= controller_name.classify %>Controller < ApplicationController
|
|
119
119
|
config.add_facet_field 'subject_geo_ssim', label: 'Region'
|
120
120
|
config.add_facet_field 'subject_era_ssim', label: 'Era'
|
121
121
|
|
122
|
-
config.add_facet_field 'example_pivot_field',
|
122
|
+
config.add_facet_field 'example_pivot_field',
|
123
|
+
label: 'Pivot Field',
|
124
|
+
pivot: ['language_ssim', 'subject_geo_ssim', 'subject_ssim'], collapsing: true
|
123
125
|
|
124
126
|
config.add_facet_field 'example_query_facet_field', label: 'Publish Date', :query => {
|
125
127
|
:years_5 => { label: 'within 5 Years', fq: "pub_date_ssim:[#{Time.zone.now.year - 5 } TO *]" },
|
data/package.json
CHANGED
@@ -40,7 +40,7 @@ RSpec.describe Blacklight::FacetItemPivotComponent, type: :component do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'has the facet hierarchy' do
|
43
|
-
expect(page).to have_css 'li ul.
|
43
|
+
expect(page).to have_css 'li.treeitem ul li.treeitem'
|
44
44
|
expect(page).to have_link 'x:1', href: nokogiri_mediated_href(facet_item.facet_item_presenters.first.href)
|
45
45
|
end
|
46
46
|
|
@@ -42,6 +42,11 @@ RSpec.describe Blacklight::Facets::ListComponent, type: :component do
|
|
42
42
|
expect(page).to have_css 'li', count: 2
|
43
43
|
end
|
44
44
|
|
45
|
+
it 'does not add a role attribute by default' do
|
46
|
+
expect(page).to have_css 'ul.facet-values'
|
47
|
+
expect(page).to have_no_css 'ul.facet-values[role]'
|
48
|
+
end
|
49
|
+
|
45
50
|
context 'with an active facet' do
|
46
51
|
let(:facet_field) do
|
47
52
|
instance_double(
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Blacklight::Facets::PivotListComponent, type: :component do
|
6
|
+
before do
|
7
|
+
render_inline(described_class.new(facet_field: facet_field))
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:facet_field) do
|
11
|
+
instance_double(
|
12
|
+
Blacklight::FacetFieldPresenter,
|
13
|
+
paginator: paginator,
|
14
|
+
facet_field: facet_config,
|
15
|
+
key: 'pivot_field',
|
16
|
+
label: 'Pivot Field',
|
17
|
+
active?: false,
|
18
|
+
collapsed?: false,
|
19
|
+
modal_path: nil,
|
20
|
+
values: []
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:facet_config) do
|
25
|
+
Blacklight::Configuration::NullField.new(
|
26
|
+
key: 'pivot_field',
|
27
|
+
item_component: Blacklight::FacetItemPivotComponent,
|
28
|
+
item_presenter: Blacklight::FacetItemPivotPresenter,
|
29
|
+
pivot: %w[field_a field_b]
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:paginator) do
|
34
|
+
instance_double(Blacklight::FacetPaginator, items: [
|
35
|
+
double(value: 'x', hits: 10),
|
36
|
+
double(value: 'y', hits: 33)
|
37
|
+
])
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'renders the facet items top ul with "pivot-facet" class' do
|
41
|
+
expect(page).to have_css 'ul.pivot-facet'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'renders the facet items with role="tree"' do
|
45
|
+
expect(page).to have_css 'ul.facet-values[role="tree"]'
|
46
|
+
end
|
47
|
+
end
|
@@ -69,7 +69,9 @@ RSpec.describe "Blacklight Advanced Search Form" do
|
|
69
69
|
it 'can limit to facets' do
|
70
70
|
fill_in 'Subject', with: 'Women'
|
71
71
|
click_on 'Language'
|
72
|
-
|
72
|
+
within '#facet-language_ssim' do
|
73
|
+
check 'Urdu 3'
|
74
|
+
end
|
73
75
|
click_on 'advanced-search-submit'
|
74
76
|
expect(page).to have_content 'Pākistānī ʻaurat dorāhe par'
|
75
77
|
expect(page).to have_no_content 'Ajikto kŭrŏk chŏrŏk sasimnikka : and 아직도 그럭 저럭 사십니까'
|
@@ -69,14 +69,14 @@ RSpec.describe "Facets" do
|
|
69
69
|
click_on 'Pivot Field'
|
70
70
|
|
71
71
|
within '#facet-example_pivot_field' do
|
72
|
-
expect(page).to have_css('.facet-leaf-node', text: "
|
73
|
-
expect(page).to have_no_css('.facet-select', text: '
|
74
|
-
|
75
|
-
click_on '
|
72
|
+
expect(page).to have_css('.facet-leaf-node', text: "Tibetan 6", normalize_ws: true)
|
73
|
+
expect(page).to have_no_css('.facet-select', text: 'India')
|
74
|
+
first('.facet-toggle-handle').click
|
75
|
+
click_on 'India'
|
76
76
|
end
|
77
77
|
|
78
|
-
expect(page).to have_css('.constraint-value', text: 'Format Book')
|
79
78
|
expect(page).to have_css('.constraint-value', text: 'Language Tibetan')
|
79
|
+
expect(page).to have_css('.constraint-value', text: 'Region India')
|
80
80
|
end
|
81
81
|
|
82
82
|
describe 'heading button focus with Firefox' do
|
@@ -18,7 +18,9 @@ RSpec.describe "Facets" do
|
|
18
18
|
expect(page).to have_css("span.facet-count.selected", text: "6")
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
within "#facet-subject_geo_ssim" do
|
22
|
+
click_on "India"
|
23
|
+
end
|
22
24
|
within ("#sortAndPerPage") do
|
23
25
|
expect(page).to have_content "1 - 2 of 2"
|
24
26
|
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: 9.0.0.
|
4
|
+
version: 9.0.0.beta5
|
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:
|
19
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rails
|
@@ -518,6 +518,7 @@ files:
|
|
518
518
|
- app/components/blacklight/facets/list_component.html.erb
|
519
519
|
- app/components/blacklight/facets/list_component.rb
|
520
520
|
- app/components/blacklight/facets/no_layout_component.rb
|
521
|
+
- app/components/blacklight/facets/pivot_list_component.rb
|
521
522
|
- app/components/blacklight/facets/selected_value_component.rb
|
522
523
|
- app/components/blacklight/facets/suggest_component.html.erb
|
523
524
|
- app/components/blacklight/facets/suggest_component.rb
|
@@ -673,7 +674,6 @@ files:
|
|
673
674
|
- app/views/catalog/_document.rss.builder
|
674
675
|
- app/views/catalog/_document_list.html.erb
|
675
676
|
- app/views/catalog/_email_form.html.erb
|
676
|
-
- app/views/catalog/_facet_pivot.html.erb
|
677
677
|
- app/views/catalog/_field.json.jbuilder
|
678
678
|
- app/views/catalog/_group.html.erb
|
679
679
|
- app/views/catalog/_home.html.erb
|
@@ -859,6 +859,7 @@ files:
|
|
859
859
|
- spec/components/blacklight/facets/index_navigation_component_spec.rb
|
860
860
|
- spec/components/blacklight/facets/item_component_spec.rb
|
861
861
|
- spec/components/blacklight/facets/list_component_spec.rb
|
862
|
+
- spec/components/blacklight/facets/pivot_list_component_spec.rb
|
862
863
|
- spec/components/blacklight/facets/suggest_component_spec.rb
|
863
864
|
- spec/components/blacklight/header_component_spec.rb
|
864
865
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
@@ -1022,7 +1023,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1022
1023
|
- !ruby/object:Gem::Version
|
1023
1024
|
version: '0'
|
1024
1025
|
requirements: []
|
1025
|
-
rubygems_version: 3.6.
|
1026
|
+
rubygems_version: 3.6.9
|
1026
1027
|
specification_version: 4
|
1027
1028
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
1028
1029
|
index.
|
@@ -1042,6 +1043,7 @@ test_files:
|
|
1042
1043
|
- spec/components/blacklight/facets/index_navigation_component_spec.rb
|
1043
1044
|
- spec/components/blacklight/facets/item_component_spec.rb
|
1044
1045
|
- spec/components/blacklight/facets/list_component_spec.rb
|
1046
|
+
- spec/components/blacklight/facets/pivot_list_component_spec.rb
|
1045
1047
|
- spec/components/blacklight/facets/suggest_component_spec.rb
|
1046
1048
|
- spec/components/blacklight/header_component_spec.rb
|
1047
1049
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|