blacklight 7.28.0 → 7.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +9 -2
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_group.scss +2 -2
- data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +7 -0
- data/app/components/blacklight/document_title_component.html.erb +2 -2
- data/app/components/blacklight/document_title_component.rb +2 -2
- data/app/components/blacklight/facet_component.rb +5 -6
- data/app/components/blacklight/icons/icon_component.rb +20 -0
- data/app/components/blacklight/response/view_type_button_component.rb +3 -0
- data/app/views/catalog/index.json.jbuilder +10 -8
- data/lib/blacklight/component.rb +3 -1
- data/lib/blacklight/configuration/fields.rb +1 -1
- data/lib/blacklight/configuration/view_config.rb +1 -1
- data/lib/blacklight/search_builder.rb +4 -1
- data/spec/components/blacklight/document_component_spec.rb +14 -0
- data/spec/components/blacklight/facet_component_spec.rb +19 -0
- data/spec/models/blacklight/configuration_spec.rb +7 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f2833ee33fe1cc1d37ef72206820efdd9bbdd4c39f14783c08bfba4c7b9dd8
|
4
|
+
data.tar.gz: 3f9cbc91061f1a1b68bd25aab95c518f134c7a497566241691a8aee63cc6b752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6500ea3048765a8e9d78425eb6f14d7a7edcb6cd17c1ddcc91c88edc7e09353672f0aa7ff29e1e85fbe238508066f9221b652c48cacbfe947e636dbac13a27
|
7
|
+
data.tar.gz: 5da051e3b7d496204d5e8752c09d346e39c0a94d917539155e60d0a2488ee3a32770bdbf205d11d9fff9da0f107c8d01b8786749ad9e9272b4b9933f46b6815e
|
data/.github/workflows/ruby.yml
CHANGED
@@ -23,6 +23,7 @@ jobs:
|
|
23
23
|
uses: ruby/setup-ruby@v1
|
24
24
|
with:
|
25
25
|
ruby-version: 2.7
|
26
|
+
bundler: 'latest'
|
26
27
|
- name: Install dependencies
|
27
28
|
run: bundle install
|
28
29
|
- name: Run linter
|
@@ -38,12 +39,13 @@ jobs:
|
|
38
39
|
uses: ruby/setup-ruby@v1
|
39
40
|
with:
|
40
41
|
ruby-version: ${{ matrix.ruby }}
|
42
|
+
bundler: 'latest'
|
41
43
|
- name: Install dependencies
|
42
44
|
run: bundle install
|
43
45
|
- name: Run tests
|
44
46
|
run: bundle exec rake ci
|
45
47
|
env:
|
46
|
-
ENGINE_CART_RAILS_OPTIONS: '
|
48
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
47
49
|
test_bootstrap5:
|
48
50
|
runs-on: ubuntu-latest
|
49
51
|
strategy:
|
@@ -55,6 +57,7 @@ jobs:
|
|
55
57
|
uses: ruby/setup-ruby@v1
|
56
58
|
with:
|
57
59
|
ruby-version: ${{ matrix.ruby }}
|
60
|
+
bundler: 'latest'
|
58
61
|
- name: Install dependencies
|
59
62
|
run: bundle install
|
60
63
|
- name: Run tests
|
@@ -73,6 +76,7 @@ jobs:
|
|
73
76
|
uses: ruby/setup-ruby@v1
|
74
77
|
with:
|
75
78
|
ruby-version: ${{ matrix.ruby }}
|
79
|
+
bundler: 'latest'
|
76
80
|
- name: Install dependencies
|
77
81
|
run: bundle install
|
78
82
|
env:
|
@@ -93,6 +97,7 @@ jobs:
|
|
93
97
|
uses: ruby/setup-ruby@v1
|
94
98
|
with:
|
95
99
|
ruby-version: ${{ matrix.ruby }}
|
100
|
+
bundler: 'latest'
|
96
101
|
- name: Install dependencies
|
97
102
|
run: bundle install
|
98
103
|
env:
|
@@ -114,6 +119,7 @@ jobs:
|
|
114
119
|
uses: ruby/setup-ruby@v1
|
115
120
|
with:
|
116
121
|
ruby-version: ${{ matrix.ruby }}
|
122
|
+
bundler: 'latest'
|
117
123
|
- name: Install dependencies
|
118
124
|
run: bundle install
|
119
125
|
env:
|
@@ -133,6 +139,7 @@ jobs:
|
|
133
139
|
- name: Set up Ruby
|
134
140
|
uses: ruby/setup-ruby@v1
|
135
141
|
with:
|
142
|
+
bundler: 'latest'
|
136
143
|
ruby-version: ${{ matrix.ruby }}
|
137
144
|
- name: Install dependencies
|
138
145
|
run: bundle install
|
@@ -140,7 +147,7 @@ jobs:
|
|
140
147
|
run: bundle exec rake ci
|
141
148
|
env:
|
142
149
|
BLACKLIGHT_API_TEST: true
|
143
|
-
ENGINE_CART_RAILS_OPTIONS: '--api --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
150
|
+
ENGINE_CART_RAILS_OPTIONS: '-a propshaft --api --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
144
151
|
docker_build:
|
145
152
|
runs-on: ubuntu-latest
|
146
153
|
steps:
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ rails generate blacklight:install
|
|
42
42
|
Code contributions are always welcome, instructions for contributing can be found at [CONTRIBUTING.md](https://github.com/projectblacklight/blacklight/blob/main/CONTRIBUTING.md).
|
43
43
|
|
44
44
|
## Configuring Apache Solr
|
45
|
-
You'll also want some information about how Blacklight expects [Apache Solr](http://lucene.apache.org/solr ) to run, which you can find in [
|
45
|
+
You'll also want some information about how Blacklight expects [Apache Solr](http://lucene.apache.org/solr ) to run, which you can find in [Solr Configuration](https://github.com/projectblacklight/blacklight/wiki/Solr-Configuration#solr-configuration)
|
46
46
|
|
47
47
|
## Building the javascript
|
48
48
|
The javascript is built by npm from sources in `app/javascript` into a bundle
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.30.0
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
input.tt-hint.form-control {
|
11
11
|
width: 100%;
|
12
|
+
filter: opacity(0.33);
|
12
13
|
}
|
13
14
|
|
14
15
|
.tt-menu {
|
@@ -27,4 +28,10 @@
|
|
27
28
|
font-size: 14px;
|
28
29
|
padding: 5px 5px 5px 10px;
|
29
30
|
}
|
31
|
+
|
32
|
+
.tt-suggestion:hover {
|
33
|
+
background-color: $dropdown-link-hover-bg;
|
34
|
+
color: $dropdown-link-hover-color;
|
35
|
+
cursor: pointer;
|
36
|
+
}
|
30
37
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<header class="documentHeader row">
|
2
2
|
<%= content_tag @as, class: @classes do %>
|
3
|
-
<%
|
3
|
+
<% before_titles.each do |t| %>
|
4
4
|
<%= t %>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%= counter -%><%= title -%>
|
8
8
|
|
9
|
-
<%
|
9
|
+
<% after_titles.each do |t| %>
|
10
10
|
<%= t %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
@@ -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
|
)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Icons
|
5
|
+
# This is the list icon for the search button.
|
6
|
+
# You can override the default svg by setting:
|
7
|
+
# Blacklight::Icons::ListComponent.svg = '<svg>your SVG here</svg>'
|
8
|
+
class IconComponent < ::ViewComponent::Base
|
9
|
+
def initialize(svg: nil)
|
10
|
+
self.svg = svg if svg
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
svg&.html_safe # rubocop:disable Rails/OutputSafety
|
15
|
+
end
|
16
|
+
|
17
|
+
class_attribute :svg
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -15,6 +15,9 @@ module Blacklight
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def icon
|
18
|
+
return render(@view.icon.new) if @view.icon.is_a?(Class)
|
19
|
+
return render(@view.icon) if @view.icon.is_a?(ViewComponent::Base)
|
20
|
+
|
18
21
|
Deprecation.silence(Blacklight::CatalogHelperBehavior) do
|
19
22
|
helpers.render_view_type_group_icon(@view.icon || @key)
|
20
23
|
end
|
@@ -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
|
|
data/lib/blacklight/component.rb
CHANGED
@@ -8,6 +8,8 @@ module Blacklight
|
|
8
8
|
@__vc_compiler ||= EngineCompiler.new(self)
|
9
9
|
end
|
10
10
|
# rubocop:enable Naming/MemoizedInstanceVariableName
|
11
|
+
|
12
|
+
alias sidecar_files _sidecar_files unless ViewComponent::Base.respond_to? :sidecar_files
|
11
13
|
end
|
12
14
|
|
13
15
|
class EngineCompiler < ::ViewComponent::Compiler
|
@@ -23,7 +25,7 @@ module Blacklight
|
|
23
25
|
@templates ||= begin
|
24
26
|
extensions = ActionView::Template.template_handler_extensions
|
25
27
|
|
26
|
-
component_class.
|
28
|
+
component_class.sidecar_files(extensions).each_with_object([]) do |path, memo|
|
27
29
|
pieces = File.basename(path).split(".")
|
28
30
|
app_path = "#{Rails.root}/#{path.slice(path.index(component_class.view_component_path)..-1)}"
|
29
31
|
|
@@ -13,7 +13,7 @@ module Blacklight
|
|
13
13
|
def define_field_access(key, base_class_name = nil, class: nil)
|
14
14
|
key = key.to_s if respond_to? :to_s
|
15
15
|
|
16
|
-
default_values[key.pluralize.to_sym] = ActiveSupport::
|
16
|
+
default_values[key.pluralize.to_sym] = ActiveSupport::HashWithIndifferentAccess.new
|
17
17
|
|
18
18
|
@field_type_for_class ||= {}
|
19
19
|
@field_type_for_class[key] = binding.local_variable_get(:class) || base_class_name
|
@@ -14,7 +14,7 @@ class Blacklight::Configuration
|
|
14
14
|
# @!attribute display_type_field
|
15
15
|
# @return [String, Symbol] solr field to use to render format-specific partials
|
16
16
|
# @!attribute icon
|
17
|
-
# @return [String, Symbol] icon file to use in the view picker
|
17
|
+
# @return [String, Symbol, Blacklight::Icons::IconComponent] icon file to use in the view picker
|
18
18
|
# @!attribute document_actions
|
19
19
|
# @return [NestedOpenStructWithHashAccess{Symbol => Blacklight::Configuration::ToolConfig}] 'tools' to render for each document
|
20
20
|
# @!attribute facet_group_component
|
@@ -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 = {}
|
@@ -45,6 +45,9 @@ module Blacklight
|
|
45
45
|
|
46
46
|
##
|
47
47
|
# Update the :q (query) parameter
|
48
|
+
# @param [Hash<Symbol,Object>] conditions the field and values to query on
|
49
|
+
# @example
|
50
|
+
# search_builder.where(id: [1,2,3]) # produces: q:"{!lucene}id:(1 OR 2 OR 3)"
|
48
51
|
def where(conditions)
|
49
52
|
Deprecation.warn(Blacklight::SearchBuilder, "SearchBuilder#where must be called with a hash, received #{conditions.inspect}.") unless conditions.is_a? Hash
|
50
53
|
params_will_change!
|
@@ -166,4 +166,18 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
|
|
166
166
|
expect(rendered).to have_content 'Thumb!'
|
167
167
|
end
|
168
168
|
end
|
169
|
+
|
170
|
+
context 'with before_title' do
|
171
|
+
let(:render) do
|
172
|
+
component.render_in(view_context) do
|
173
|
+
component.title do |c|
|
174
|
+
c.before_title { 'Prefix!' }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'shows the prefix' do
|
180
|
+
expect(rendered).to have_content "Prefix!"
|
181
|
+
end
|
182
|
+
end
|
169
183
|
end
|
@@ -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!
|
@@ -39,13 +39,13 @@ RSpec.describe "Blacklight::Configuration", api: true do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "has ordered hashes for field configuration" do
|
42
|
-
expect(config.facet_fields).to be_a_kind_of ActiveSupport::
|
43
|
-
expect(config.index_fields).to be_a_kind_of ActiveSupport::
|
44
|
-
expect(config.show_fields).to be_a_kind_of ActiveSupport::
|
45
|
-
expect(config.search_fields).to be_a_kind_of ActiveSupport::
|
46
|
-
expect(config.show_fields).to be_a_kind_of ActiveSupport::
|
47
|
-
expect(config.search_fields).to be_a_kind_of ActiveSupport::
|
48
|
-
expect(config.sort_fields).to be_a_kind_of ActiveSupport::
|
42
|
+
expect(config.facet_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
43
|
+
expect(config.index_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
44
|
+
expect(config.show_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
45
|
+
expect(config.search_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
46
|
+
expect(config.show_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
47
|
+
expect(config.search_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
48
|
+
expect(config.sort_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
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.30.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-10-03 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -470,6 +470,7 @@ files:
|
|
470
470
|
- app/components/blacklight/facet_item_component.rb
|
471
471
|
- app/components/blacklight/facet_item_pivot_component.rb
|
472
472
|
- app/components/blacklight/hidden_search_state_component.rb
|
473
|
+
- app/components/blacklight/icons/icon_component.rb
|
473
474
|
- app/components/blacklight/metadata_field_component.html.erb
|
474
475
|
- app/components/blacklight/metadata_field_component.rb
|
475
476
|
- app/components/blacklight/metadata_field_layout_component.html.erb
|