blacklight 7.39.0 → 7.41.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/.env +1 -1
- data/.github/matrix.json +62 -0
- data/.github/workflows/build.yml +16 -0
- data/.github/workflows/lint.yml +23 -0
- data/.github/workflows/main.yml +23 -0
- data/.github/workflows/test.yml +53 -0
- data/.rubocop.yml +1 -0
- data/VERSION +1 -1
- data/app/components/blacklight/document/action_component.rb +1 -3
- data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +10 -0
- data/app/components/blacklight/search_context/server_item_pagination_component.rb +15 -0
- data/app/components/blacklight/search_context_component.rb +1 -0
- data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/url_helper_behavior.rb +2 -2
- data/app/presenters/blacklight/document_presenter.rb +29 -10
- data/app/presenters/blacklight/index_presenter.rb +1 -1
- data/app/presenters/blacklight/json_presenter.rb +1 -3
- data/app/views/catalog/_previous_next_doc.html.erb +1 -1
- data/blacklight.gemspec +2 -2
- data/docker-compose.yml +1 -0
- data/lib/blacklight/component.rb +10 -47
- data/lib/blacklight/nested_open_struct_with_hash_access.rb +1 -1
- data/lib/generators/blacklight/controller_generator.rb +1 -1
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +1 -1
- data/lib/generators/blacklight/test_support_generator.rb +1 -1
- data/package.json +1 -1
- data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +35 -0
- data/spec/components/blacklight/search_context_component_spec.rb +31 -0
- data/spec/features/facets_spec.rb +3 -5
- data/spec/features/search_context_spec.rb +1 -1
- data/spec/lib/blacklight/component_spec.rb +32 -27
- data/spec/models/solr_document_spec.rb +3 -1
- data/spec/presenters/blacklight/document_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/index_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/show_presenter_spec.rb +1 -0
- data/spec/spec_helper.rb +5 -2
- metadata +17 -7
- data/.github/workflows/ruby.yml +0 -159
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999d98759b905568ee633ca05e1d7b054564d9bd7467d55e7bf816da365a1941
|
4
|
+
data.tar.gz: 452085f8079287d578b2141429077134ea68dd9a7da08372971f868acfe28f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f9ed2a7d1f1b03b8a1f704a5233eec2aa6885ca2637ef60e315a286e834740388f3c8c203f0cc78b98bc6c9463cf562fcd54bdc5f2e6423c4c2925a26bdc32
|
7
|
+
data.tar.gz: 78c0f61b1c4d821f084eea9a994947042c7f3afb3c8383ece3f95a44498d227f558256460ef215197e6b776aac52f53158b1e53aaca0267fc774de0c52d5938e
|
data/.env
CHANGED
data/.github/matrix.json
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"ruby": ["3.3"],
|
3
|
+
"rails_version": [
|
4
|
+
"7.1.5.1",
|
5
|
+
"7.2.2.1"
|
6
|
+
],
|
7
|
+
"bootstrap_version": [
|
8
|
+
null
|
9
|
+
],
|
10
|
+
"view_component_version": [
|
11
|
+
"~> 3.12"
|
12
|
+
],
|
13
|
+
"api": [
|
14
|
+
null
|
15
|
+
],
|
16
|
+
"additional_engine_cart_rails_options": [
|
17
|
+
""
|
18
|
+
],
|
19
|
+
"additional_name": [
|
20
|
+
""
|
21
|
+
],
|
22
|
+
"include": [
|
23
|
+
{
|
24
|
+
"ruby": "3.2",
|
25
|
+
"rails_version": "7.1.5.1"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"ruby": "3.3",
|
29
|
+
"rails_version": "7.1.5.1",
|
30
|
+
"bootstrap_version": "~> 5.0",
|
31
|
+
"additional_name": "| bootstrap 5"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"ruby": "3.4",
|
35
|
+
"rails_version": "7.2.2.1"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"ruby": "3.4",
|
39
|
+
"rails_version": "8.0.2"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"ruby": "3.3",
|
43
|
+
"rails_version": "7.1.5.1",
|
44
|
+
"view_component_version": "~> 2.74",
|
45
|
+
"additional_name": "| View Component 2"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"ruby": "3.2",
|
49
|
+
"rails_version": "7.1.5.1",
|
50
|
+
"api": "true",
|
51
|
+
"additional_engine_cart_rails_options": "--api --skip-yarn",
|
52
|
+
"additional_name": "| API"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"ruby": "3.3",
|
56
|
+
"rails_version": "7.1.5.1",
|
57
|
+
"api:": "true",
|
58
|
+
"additional_engine_cart_rails_options": "--api --skip-yarn",
|
59
|
+
"additional_name": "| API"
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
on:
|
2
|
+
workflow_call:
|
3
|
+
inputs:
|
4
|
+
ref:
|
5
|
+
required: false
|
6
|
+
type: string
|
7
|
+
default: ''
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v4
|
13
|
+
with:
|
14
|
+
ref: ${{ inputs.ref }}
|
15
|
+
- name: Build docker image
|
16
|
+
run: docker compose build app
|
@@ -0,0 +1,23 @@
|
|
1
|
+
on:
|
2
|
+
workflow_call:
|
3
|
+
inputs:
|
4
|
+
ref:
|
5
|
+
required: false
|
6
|
+
type: string
|
7
|
+
default: ''
|
8
|
+
jobs:
|
9
|
+
lint:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v4
|
13
|
+
with:
|
14
|
+
ref: ${{ inputs.ref }}
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: 3.2
|
19
|
+
bundler: "default"
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
- name: Run linter
|
23
|
+
run: bundle exec rake rubocop
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: CI
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches:
|
13
|
+
- main
|
14
|
+
- 'release-*'
|
15
|
+
pull_request:
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
lint:
|
19
|
+
uses: ./.github/workflows/lint.yml
|
20
|
+
test:
|
21
|
+
uses: ./.github/workflows/test.yml
|
22
|
+
docker_build:
|
23
|
+
uses: ./.github/workflows/build.yml
|
@@ -0,0 +1,53 @@
|
|
1
|
+
on:
|
2
|
+
workflow_call:
|
3
|
+
inputs:
|
4
|
+
ref:
|
5
|
+
required: false
|
6
|
+
type: string
|
7
|
+
default: ''
|
8
|
+
description: The branch or reference to run the workflow against
|
9
|
+
jobs:
|
10
|
+
set_matrix:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
outputs:
|
13
|
+
matrix: ${{ steps.matrix.outputs.matrix }}
|
14
|
+
steps:
|
15
|
+
- name: Checkout repository
|
16
|
+
uses: actions/checkout@v3
|
17
|
+
with:
|
18
|
+
ref: ${{ inputs.ref }}
|
19
|
+
- name: Echo ./.github/matrix.json
|
20
|
+
id: matrix
|
21
|
+
run: |
|
22
|
+
echo "matrix<<EOF" >> $GITHUB_OUTPUT
|
23
|
+
cat ./.github/matrix.json >> $GITHUB_OUTPUT
|
24
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
25
|
+
test:
|
26
|
+
needs: set_matrix
|
27
|
+
runs-on: ubuntu-latest
|
28
|
+
name: ruby ${{ matrix.ruby }} | rails ${{ matrix.rails_version }} ${{ matrix.additional_name }}
|
29
|
+
strategy:
|
30
|
+
fail-fast: false
|
31
|
+
matrix: ${{fromJson(needs.set_matrix.outputs.matrix)}}
|
32
|
+
env:
|
33
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
34
|
+
SOLR_VERSION: ${{ matrix.solr_version || 'latest' }}
|
35
|
+
VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
|
36
|
+
BOOTSTRAP_VERSION: ${{ matrix.bootstrap_version }}
|
37
|
+
BLACKLIGHT_API_TEST: ${{ matrix.api }}
|
38
|
+
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-kamal --skip-solid --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
|
39
|
+
steps:
|
40
|
+
- uses: actions/checkout@v4
|
41
|
+
with:
|
42
|
+
ref: ${{ inputs.ref }}
|
43
|
+
- name: Set up Ruby
|
44
|
+
uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
bundler: "latest"
|
47
|
+
ruby-version: ${{ matrix.ruby }}
|
48
|
+
- name: Change permissions
|
49
|
+
run: "chmod -f -R o-w /opt/hostedtoolcache/Ruby/3.2.5/x64/lib/ruby/gems/3.2.0/gems | :"
|
50
|
+
- name: Install dependencies
|
51
|
+
run: bundle install
|
52
|
+
- name: Run tests
|
53
|
+
run: bundle exec rake ci
|
data/.rubocop.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.41.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module SearchContext
|
5
|
+
class ServerItemPaginationComponent < Blacklight::SearchContextComponent
|
6
|
+
with_collection_parameter :search_context
|
7
|
+
|
8
|
+
def initialize(search_context:, search_session:, current_document:)
|
9
|
+
@search_context = search_context
|
10
|
+
@search_session = search_session
|
11
|
+
@current_document_id = current_document.id
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -5,6 +5,7 @@ module Blacklight
|
|
5
5
|
with_collection_parameter :search_context
|
6
6
|
|
7
7
|
def initialize(search_context:, search_session:)
|
8
|
+
Deprecation.warn("Blacklight::SearchContextComponent is deprecated and will be moved to Blacklight::SearchContext::ServerItemPaginationComponent in Blacklight 8.0.0")
|
8
9
|
@search_context = search_context
|
9
10
|
@search_session = search_session
|
10
11
|
end
|
@@ -106,7 +106,7 @@ module Blacklight::CatalogHelperBehavior
|
|
106
106
|
total: number_with_delimiter(search_session['total']),
|
107
107
|
count: search_session['total'].to_i).html_safe
|
108
108
|
end
|
109
|
-
deprecation_deprecate item_page_entry_info: 'Use Blacklight::
|
109
|
+
deprecation_deprecate item_page_entry_info: 'Use Blacklight::SearchContext::ServerItemPaginationComponent methods instead'
|
110
110
|
|
111
111
|
##
|
112
112
|
# Look up search field user-displayable label
|
@@ -58,7 +58,7 @@ module Blacklight::UrlHelperBehavior
|
|
58
58
|
tag.span raw(t('views.pagination.previous')), class: 'previous'
|
59
59
|
end
|
60
60
|
end
|
61
|
-
deprecation_deprecate link_to_previous_document: 'Moving to Blacklight::
|
61
|
+
deprecation_deprecate link_to_previous_document: 'Moving to Blacklight::SearchContext::ServerItemPaginationComponent'
|
62
62
|
|
63
63
|
##
|
64
64
|
# Link to the next document in the current search context
|
@@ -69,7 +69,7 @@ module Blacklight::UrlHelperBehavior
|
|
69
69
|
tag.span raw(t('views.pagination.next')), class: 'next'
|
70
70
|
end
|
71
71
|
end
|
72
|
-
deprecation_deprecate link_to_previous_document: 'Moving to Blacklight::
|
72
|
+
deprecation_deprecate link_to_previous_document: 'Moving to Blacklight::SearchContext::ServerItemPaginationComponent'
|
73
73
|
|
74
74
|
##
|
75
75
|
# Attributes for a link that gives a URL we can use to track clicks for the current search session
|
@@ -11,18 +11,26 @@ module Blacklight
|
|
11
11
|
# @param [SolrDocument] document
|
12
12
|
# @param [ActionView::Base] view_context scope for linking and generating urls
|
13
13
|
# @param [Blacklight::Configuration] configuration
|
14
|
-
def initialize(document, view_context, configuration = view_context.blacklight_config)
|
14
|
+
def initialize(document, view_context, configuration = view_context.blacklight_config, view_config: nil, field_presenter_options: {})
|
15
15
|
@document = document
|
16
16
|
@view_context = view_context
|
17
17
|
@configuration = configuration
|
18
|
+
@view_config = view_config
|
19
|
+
@field_presenter_options = field_presenter_options
|
18
20
|
end
|
19
21
|
|
20
22
|
# @return [Hash<String,Configuration::Field>] all the fields for this index view that should be rendered
|
21
|
-
def fields_to_render
|
22
|
-
|
23
|
+
def fields_to_render(document_fields = fields, **kwargs)
|
24
|
+
unless block_given?
|
25
|
+
return to_enum(:fields_to_render, document_fields, **kwargs) unless method(:fields_to_render).arity.zero?
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
Deprecation.warn(self.class, 'In Blacklight 8, Blacklight::DocumentPresenter#fields_to_render accepts additional arguments')
|
28
|
+
|
29
|
+
return to_enum(:fields_to_render)
|
30
|
+
end
|
31
|
+
|
32
|
+
document_fields.each do |name, field_config|
|
33
|
+
field_presenter = field_presenter(field_config, kwargs)
|
26
34
|
|
27
35
|
next unless field_presenter.render_field? && field_presenter.any?
|
28
36
|
|
@@ -30,10 +38,21 @@ module Blacklight
|
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
33
|
-
def field_presenters
|
34
|
-
|
41
|
+
def field_presenters(document_fields = fields, **kwargs)
|
42
|
+
unless block_given?
|
43
|
+
return to_enum(:field_presenters, document_fields, **kwargs) unless method(:field_presenters).arity.zero?
|
44
|
+
|
45
|
+
Deprecation.warn(self.class, 'In Blacklight 8, Blacklight::DocumentPresenter#field_presenters accepts additional arguments')
|
35
46
|
|
36
|
-
|
47
|
+
return to_enum(:field_presenters)
|
48
|
+
end
|
49
|
+
|
50
|
+
if method(:fields_to_render).arity.zero?
|
51
|
+
Deprecation.warn(self.class, 'In Blacklight 8, Blacklight::DocumentPresenter#fields_to_render accept additional arguments')
|
52
|
+
fields_to_render.each { |_, _, config| yield config }
|
53
|
+
else
|
54
|
+
fields_to_render(document_fields, **kwargs).each { |_, _, config| yield config }
|
55
|
+
end
|
37
56
|
end
|
38
57
|
|
39
58
|
##
|
@@ -122,7 +141,7 @@ module Blacklight
|
|
122
141
|
end
|
123
142
|
|
124
143
|
def show_view_config
|
125
|
-
configuration.view_config(:show)
|
144
|
+
configuration.view_config(:show, action_name: view_context.action_name)
|
126
145
|
end
|
127
146
|
|
128
147
|
def inspect
|
@@ -158,7 +177,7 @@ module Blacklight
|
|
158
177
|
end
|
159
178
|
|
160
179
|
def field_presenter_options
|
161
|
-
{}
|
180
|
+
@field_presenter_options ||= {}
|
162
181
|
end
|
163
182
|
end
|
164
183
|
end
|
@@ -30,7 +30,7 @@ module Blacklight
|
|
30
30
|
deprecation_deprecate label: 'Use #heading'
|
31
31
|
|
32
32
|
def view_config
|
33
|
-
@view_config ||= configuration.view_config(view_context.document_index_view_type)
|
33
|
+
@view_config ||= configuration.view_config(view_context.document_index_view_type, action_name: view_context.action_name)
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<% Deprecation.warn(self, 'The partial _previous_next_doc.html.erb will be removed in 8.0. Render Blacklight::
|
1
|
+
<% Deprecation.warn(self, 'The partial _previous_next_doc.html.erb will be removed in 8.0. Render Blacklight::SearchContext::ServerItemPaginationComponent instead.') %>
|
2
2
|
<%= render(Blacklight::SearchContextComponent.new(search_context: @search_context, search_session: search_session)) %>
|
data/blacklight.gemspec
CHANGED
@@ -25,14 +25,14 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
s.required_ruby_version = '>= 2.7'
|
27
27
|
|
28
|
-
s.add_dependency "rails", '>= 6.1', '<
|
28
|
+
s.add_dependency "rails", '>= 6.1', '< 8.1'
|
29
29
|
s.add_dependency "globalid"
|
30
30
|
s.add_dependency "jbuilder", '~> 2.7'
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
32
32
|
s.add_dependency "deprecation"
|
33
33
|
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
34
34
|
s.add_dependency "ostruct", '>= 0.3.2'
|
35
|
-
s.add_dependency "view_component", '>= 2.
|
35
|
+
s.add_dependency "view_component", '>= 2.74', '< 4'
|
36
36
|
s.add_dependency 'hashdiff'
|
37
37
|
s.add_dependency "zeitwerk"
|
38
38
|
|
data/docker-compose.yml
CHANGED
@@ -23,6 +23,7 @@ services:
|
|
23
23
|
environment:
|
24
24
|
- SOLR_PORT # Set via environment variable or use default defined in .env file
|
25
25
|
- SOLR_VERSION # Set via environment variable or use default defined in .env file
|
26
|
+
- SOLR_MODULES=analysis-extras
|
26
27
|
image: "solr:${SOLR_VERSION}"
|
27
28
|
volumes:
|
28
29
|
- $PWD/lib/generators/blacklight/templates/solr/conf:/opt/solr/conf
|
data/lib/blacklight/component.rb
CHANGED
@@ -3,57 +3,20 @@
|
|
3
3
|
module Blacklight
|
4
4
|
class Component < ViewComponent::Base
|
5
5
|
class << self
|
6
|
-
|
7
|
-
def config
|
8
|
-
@config ||= ViewComponent::Config.defaults.merge(ViewComponent::Base.config)
|
9
|
-
end
|
6
|
+
alias upstream_sidecar_files sidecar_files
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
@__vc_compiler ||= EngineCompiler.new(self)
|
8
|
+
def reset_compiler!
|
9
|
+
@__vc_compiler = nil
|
14
10
|
end
|
15
|
-
# rubocop:enable Naming/MemoizedInstanceVariableName
|
16
|
-
|
17
|
-
alias sidecar_files _sidecar_files unless ViewComponent::Base.respond_to? :sidecar_files
|
18
|
-
end
|
19
|
-
|
20
|
-
EXCLUDE_VARIABLES = [
|
21
|
-
:@lookup_context, :@view_renderer, :@view_flow, :@view_context,
|
22
|
-
:@tag_builder, :@current_template,
|
23
|
-
:@__vc_set_slots, :@__vc_original_view_context,
|
24
|
-
:@__vc_variant, :@__vc_content_evaluated,
|
25
|
-
:@__vc_render_in_block, :@__vc_content, :@__vc_helpers
|
26
|
-
].freeze
|
27
|
-
|
28
|
-
def inspect
|
29
|
-
# Exclude variables added by render_in
|
30
|
-
render_variables = instance_variables - EXCLUDE_VARIABLES
|
31
|
-
fields = render_variables.map { |ivar| "#{ivar}:#{instance_variable_get(ivar).inspect}" }.join(', ')
|
32
|
-
"#<#{self.class.name}:#{object_id} #{fields}>"
|
33
|
-
end
|
34
|
-
|
35
|
-
class EngineCompiler < ::ViewComponent::Compiler
|
36
|
-
# ViewComponent::Compiler locates and caches templates from sidecar files to the component source file.
|
37
|
-
# While this is sensible in a Rails application, it prevents component templates defined in an Engine
|
38
|
-
# from being overridden by an installing application without subclassing the component, which may also
|
39
|
-
# require modifying any partials rendering the component. This subclass of compiler overrides the template
|
40
|
-
# location algorithm to take the sidecar file names from the Engine, but look to see if a file of the
|
41
|
-
# same name existing in the installing application (ie, under Rails.root). If the latter exists, this
|
42
|
-
# compiler will cache that template instead of the engine-defined file; if not, the compiler will fall
|
43
|
-
# back to the engine-defined file.
|
44
|
-
def templates
|
45
|
-
@templates ||= begin
|
46
|
-
extensions = ActionView::Template.template_handler_extensions
|
47
11
|
|
48
|
-
|
49
|
-
|
50
|
-
|
12
|
+
def sidecar_files(*args, **kwargs)
|
13
|
+
upstream_sidecar_files(*args, **kwargs).map do |path|
|
14
|
+
app_path = Rails.root.join(path.slice(path.index(view_component_path)..-1).to_s).to_s
|
51
15
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
16
|
+
if File.exist?(app_path)
|
17
|
+
app_path
|
18
|
+
else
|
19
|
+
path
|
57
20
|
end
|
58
21
|
end
|
59
22
|
end
|
@@ -30,7 +30,7 @@ module Blacklight
|
|
30
30
|
route <<-EOF
|
31
31
|
concern :searchable, Blacklight::Routes::Searchable.new
|
32
32
|
|
33
|
-
resource :catalog, only: [
|
33
|
+
resource :catalog, only: [], as: 'catalog', path: '/catalog', controller: 'catalog' do
|
34
34
|
concerns :searchable
|
35
35
|
end
|
36
36
|
EOF
|
@@ -16,7 +16,7 @@
|
|
16
16
|
</updateLog>
|
17
17
|
</updateHandler>
|
18
18
|
|
19
|
-
<!-- solr lib dirs -->
|
19
|
+
<!-- solr lib dirs, which are needed for Solr 8 compatibility but ignored in solr 9.8 and above -->
|
20
20
|
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
|
21
21
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
22
22
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
@@ -17,7 +17,7 @@ module Blacklight
|
|
17
17
|
copy_file "alternate_controller.rb", "app/controllers/alternate_controller.rb"
|
18
18
|
|
19
19
|
routing_code = <<-EOF
|
20
|
-
resource :alternate, controller: 'alternate', only: [
|
20
|
+
resource :alternate, controller: 'alternate', only: [] do
|
21
21
|
concerns :searchable
|
22
22
|
end
|
23
23
|
EOF
|
data/package.json
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Blacklight::SearchContext::ServerItemPaginationComponent, type: :component do
|
6
|
+
subject(:render) { render_inline(instance) }
|
7
|
+
|
8
|
+
let(:current_document_id) { 9 }
|
9
|
+
let(:current_document) { SolrDocument.new(id: current_document_id) }
|
10
|
+
let(:search_session) { { 'document_id' => current_document_id, 'counter' => 1, 'total' => '3' } }
|
11
|
+
let(:instance) { described_class.new(search_context: search_context, search_session: search_session, current_document: current_document) }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(controller).to receive(:search_session).and_return(search_session)
|
15
|
+
allow(controller).to receive(:current_search_session).and_return(double(id: current_document_id))
|
16
|
+
controller.class.helper_method :search_session
|
17
|
+
controller.class.helper_method :current_search_session
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when there is next and previous' do
|
21
|
+
let(:search_context) { { next: next_doc, prev: prev_doc } }
|
22
|
+
let(:prev_doc) { SolrDocument.new(id: '777') }
|
23
|
+
let(:next_doc) { SolrDocument.new(id: '888') }
|
24
|
+
|
25
|
+
before do
|
26
|
+
# allow(controller).to receive(:controller_tracking_method).and_return('track_catalog_path')
|
27
|
+
|
28
|
+
allow(controller).to receive_messages(controller_name: 'catalog', link_to_previous_document: '', link_to_next_document: '')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "renders content" do
|
32
|
+
expect(render.css('.page-links').to_html).not_to be_blank
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
RSpec.describe Blacklight::SearchContextComponent, type: :component do
|
5
|
+
subject(:render) { render_inline(instance) }
|
6
|
+
|
7
|
+
let(:current_document_id) { 9 }
|
8
|
+
let(:search_session) { { 'document_id' => current_document_id, 'counter' => 1, 'total' => '3' } }
|
9
|
+
let(:instance) { described_class.new(search_context: search_context, search_session: search_session) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
allow(controller).to receive(:search_session).and_return(search_session)
|
13
|
+
allow(controller).to receive(:current_search_session).and_return(double(id: current_document_id))
|
14
|
+
controller.class.helper_method :search_session
|
15
|
+
controller.class.helper_method :current_search_session
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when there is next and previous' do
|
19
|
+
let(:search_context) { { next: next_doc, prev: prev_doc } }
|
20
|
+
let(:prev_doc) { SolrDocument.new(id: '777') }
|
21
|
+
let(:next_doc) { SolrDocument.new(id: '888') }
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow(controller).to receive_messages(controller_name: 'catalog', link_to_previous_document: '', link_to_next_document: '')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "renders content" do
|
28
|
+
expect(render.css('.page-links').to_html).not_to be_blank
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -79,13 +79,11 @@ RSpec.describe "Facets" do
|
|
79
79
|
expect(page).to have_css('.constraint-value', text: 'Language Tibetan')
|
80
80
|
end
|
81
81
|
|
82
|
-
describe 'heading button focus
|
83
|
-
it 'changes to the button on button click
|
84
|
-
pending 'Capybara::NotSupportedByDriverError: Capybara::Driver::Base#evaluate_script'
|
82
|
+
describe 'heading button focus' do
|
83
|
+
it 'changes to the button on button click', js: true do
|
85
84
|
visit root_path
|
86
85
|
page.find('h3.facet-field-heading button', text: 'Format').click
|
87
|
-
|
88
|
-
expect(focused_element_data_target).to eq '#facet-format'
|
86
|
+
expect(page.active_element.text).to eq 'Format'
|
89
87
|
end
|
90
88
|
end
|
91
89
|
|
@@ -35,7 +35,7 @@ RSpec.describe "Search Results context", js: true do
|
|
35
35
|
it "does not display stale previous and next links for direct item views" do
|
36
36
|
search_for ''
|
37
37
|
click_on 'Pluvial nectar of blessings'
|
38
|
-
|
38
|
+
expect(page).to have_link('Cite')
|
39
39
|
# Go to the number 9 result separately
|
40
40
|
visit '/catalog/2003546302'
|
41
41
|
expect(page).not_to have_selector '.page-links'
|
@@ -1,43 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe Blacklight::Component do
|
4
|
-
let(:component_class) { Blacklight::
|
3
|
+
RSpec.describe Blacklight::Component, type: :component do
|
4
|
+
let(:component_class) { Blacklight::System::ModalComponent }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
before do
|
7
|
+
component_class.reset_compiler!
|
8
|
+
ViewComponent::CompileCache.invalidate!
|
9
|
+
|
10
|
+
component_class.class_eval do
|
11
|
+
undef :call if method_defined?(:call)
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
after do
|
16
|
+
component_class.reset_compiler!
|
17
|
+
ViewComponent::CompileCache.invalidate!
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
component_class.class_eval do
|
20
|
+
undef :call if method_defined?(:call)
|
21
|
+
end
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
24
|
+
context "without overrides" do
|
25
|
+
it "renders the engine template" do
|
26
|
+
render_inline(component_class.new)
|
27
|
+
expect(page).to have_css('.modal-header')
|
25
28
|
end
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
context "with overrides" do
|
32
|
+
around do |ex|
|
33
|
+
FileUtils.mkdir_p(Rails.root.join('app/components/blacklight/system'))
|
34
|
+
Rails.root.join("app/components/blacklight/system/modal_component.html.erb").open("w") do |f|
|
35
|
+
f.puts '<div class="custom-modal">Overridden</div>'
|
30
36
|
end
|
31
37
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
ex.run
|
39
|
+
ensure
|
40
|
+
Rails.root.join('app/components/blacklight/system/modal_component.html.erb').unlink
|
41
|
+
end
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
43
|
+
it "renders to application template" do
|
44
|
+
render_inline(component_class.new)
|
45
|
+
expect(page).to have_css('.custom-modal')
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
@@ -37,7 +37,9 @@ RSpec.describe SolrDocument, api: true do
|
|
37
37
|
title_tesim: ['Good Omens'])
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
40
|
+
it 'ends with the expected information' do
|
41
|
+
expect(inspect).to match(/_source: {"id" ?=> ?"123", "title_tesim" ?=> ?\["Good Omens"\]\}>$/)
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
describe '.attribute' do
|
@@ -22,6 +22,7 @@ RSpec.describe Blacklight::ShowPresenter, api: true do
|
|
22
22
|
|
23
23
|
before do
|
24
24
|
allow(request_context).to receive(:search_state).and_return(search_state)
|
25
|
+
allow(request_context).to receive(:action_name).and_return(:show)
|
25
26
|
end
|
26
27
|
|
27
28
|
describe "link_rel_alternates" do
|
data/spec/spec_helper.rb
CHANGED
@@ -48,8 +48,11 @@ RSpec.configure do |config|
|
|
48
48
|
# When we're testing the API, only run the api tests
|
49
49
|
config.filter_run api: true if ENV['BLACKLIGHT_API_TEST']
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
if Rails.version.to_f >= 7.1
|
52
|
+
config.fixture_paths = [Rails.root.join("spec/fixtures")]
|
53
|
+
else
|
54
|
+
config.fixture_path = Rails.root.join("spec/fixtures")
|
55
|
+
end
|
53
56
|
|
54
57
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
55
58
|
# examples within a transaction, remove the following line or assign false
|
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.41.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:
|
20
|
+
date: 2025-05-30 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
version: '6.1'
|
29
29
|
- - "<"
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: '
|
31
|
+
version: '8.1'
|
32
32
|
type: :runtime
|
33
33
|
prerelease: false
|
34
34
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
version: '6.1'
|
39
39
|
- - "<"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '8.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: globalid
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '2.
|
132
|
+
version: '2.74'
|
133
133
|
- - "<"
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '4'
|
@@ -139,7 +139,7 @@ dependencies:
|
|
139
139
|
requirements:
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '2.
|
142
|
+
version: '2.74'
|
143
143
|
- - "<"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '4'
|
@@ -417,7 +417,11 @@ files:
|
|
417
417
|
- ".docker/app/entrypoint.sh"
|
418
418
|
- ".dockerignore"
|
419
419
|
- ".env"
|
420
|
-
- ".github/
|
420
|
+
- ".github/matrix.json"
|
421
|
+
- ".github/workflows/build.yml"
|
422
|
+
- ".github/workflows/lint.yml"
|
423
|
+
- ".github/workflows/main.yml"
|
424
|
+
- ".github/workflows/test.yml"
|
421
425
|
- ".gitignore"
|
422
426
|
- ".hound.yml"
|
423
427
|
- ".jshintrc"
|
@@ -528,6 +532,8 @@ files:
|
|
528
532
|
- app/components/blacklight/search_bar_component.html.erb
|
529
533
|
- app/components/blacklight/search_bar_component.rb
|
530
534
|
- app/components/blacklight/search_button_component.rb
|
535
|
+
- app/components/blacklight/search_context/server_item_pagination_component.html.erb
|
536
|
+
- app/components/blacklight/search_context/server_item_pagination_component.rb
|
531
537
|
- app/components/blacklight/search_context_component.html.erb
|
532
538
|
- app/components/blacklight/search_context_component.rb
|
533
539
|
- app/components/blacklight/search_history_constraint_layout_component.rb
|
@@ -841,6 +847,8 @@ files:
|
|
841
847
|
- spec/components/blacklight/response/pagination_component_spec.rb
|
842
848
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
843
849
|
- spec/components/blacklight/search_bar_component_spec.rb
|
850
|
+
- spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
|
851
|
+
- spec/components/blacklight/search_context_component_spec.rb
|
844
852
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
845
853
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
846
854
|
- spec/controllers/alternate_controller_spec.rb
|
@@ -1029,6 +1037,8 @@ test_files:
|
|
1029
1037
|
- spec/components/blacklight/response/pagination_component_spec.rb
|
1030
1038
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
1031
1039
|
- spec/components/blacklight/search_bar_component_spec.rb
|
1040
|
+
- spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
|
1041
|
+
- spec/components/blacklight/search_context_component_spec.rb
|
1032
1042
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
1033
1043
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
1034
1044
|
- spec/controllers/alternate_controller_spec.rb
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: CI
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches:
|
13
|
-
- main
|
14
|
-
- 'release-*'
|
15
|
-
pull_request:
|
16
|
-
|
17
|
-
jobs:
|
18
|
-
lint:
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
steps:
|
21
|
-
- uses: actions/checkout@v2
|
22
|
-
- name: Set up Ruby
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: 3.1
|
26
|
-
bundler: 'default'
|
27
|
-
- name: Install dependencies
|
28
|
-
run: bundle install
|
29
|
-
- name: Run linter
|
30
|
-
run: bundle exec rake rubocop
|
31
|
-
test:
|
32
|
-
runs-on: ubuntu-latest
|
33
|
-
strategy:
|
34
|
-
matrix:
|
35
|
-
ruby: [3.1, 3.2]
|
36
|
-
env:
|
37
|
-
RAILS_VERSION: 7.0.8
|
38
|
-
steps:
|
39
|
-
- uses: actions/checkout@v2
|
40
|
-
- name: Set up Ruby
|
41
|
-
uses: ruby/setup-ruby@v1
|
42
|
-
with:
|
43
|
-
ruby-version: ${{ matrix.ruby }}
|
44
|
-
bundler: 'default'
|
45
|
-
- name: Install dependencies
|
46
|
-
run: bundle install
|
47
|
-
- name: Run tests
|
48
|
-
run: bundle exec rake ci
|
49
|
-
env:
|
50
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
51
|
-
test_bootstrap5:
|
52
|
-
runs-on: ubuntu-latest
|
53
|
-
strategy:
|
54
|
-
matrix:
|
55
|
-
ruby: ['3.0']
|
56
|
-
env:
|
57
|
-
RAILS_VERSION: 7.0.8
|
58
|
-
steps:
|
59
|
-
- uses: actions/checkout@v2
|
60
|
-
- name: Set up Ruby
|
61
|
-
uses: ruby/setup-ruby@v1
|
62
|
-
with:
|
63
|
-
ruby-version: ${{ matrix.ruby }}
|
64
|
-
bundler: 'default'
|
65
|
-
- name: Install dependencies
|
66
|
-
run: bundle install
|
67
|
-
- name: Run tests
|
68
|
-
run: bundle exec rake ci
|
69
|
-
env:
|
70
|
-
BOOTSTRAP_VERSION: '~> 5.0'
|
71
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
72
|
-
test_rails6_1:
|
73
|
-
runs-on: ubuntu-latest
|
74
|
-
strategy:
|
75
|
-
matrix:
|
76
|
-
ruby: ['3.0']
|
77
|
-
env:
|
78
|
-
RAILS_VERSION: 6.1.6.1
|
79
|
-
steps:
|
80
|
-
- uses: actions/checkout@v2
|
81
|
-
- name: Set up Ruby
|
82
|
-
uses: ruby/setup-ruby@v1
|
83
|
-
with:
|
84
|
-
ruby-version: ${{ matrix.ruby }}
|
85
|
-
bundler: 'default'
|
86
|
-
- name: Install dependencies
|
87
|
-
run: bundle install
|
88
|
-
- name: Run tests
|
89
|
-
run: bundle exec rake ci
|
90
|
-
env:
|
91
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-keeps --skip-action-cable --skip-test'
|
92
|
-
test_rails7_2:
|
93
|
-
runs-on: ubuntu-latest
|
94
|
-
strategy:
|
95
|
-
matrix:
|
96
|
-
ruby: [3.1, 3.2]
|
97
|
-
env:
|
98
|
-
RAILS_VERSION: 7.2.0
|
99
|
-
steps:
|
100
|
-
- uses: actions/checkout@v2
|
101
|
-
- name: Set up Ruby
|
102
|
-
uses: ruby/setup-ruby@v1
|
103
|
-
with:
|
104
|
-
ruby-version: ${{ matrix.ruby }}
|
105
|
-
bundler: 'default'
|
106
|
-
- name: Install dependencies
|
107
|
-
run: bundle install
|
108
|
-
- name: Run tests
|
109
|
-
run: bundle exec rake ci
|
110
|
-
env:
|
111
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-keeps --skip-test'
|
112
|
-
test_vc3:
|
113
|
-
runs-on: ubuntu-latest
|
114
|
-
strategy:
|
115
|
-
matrix:
|
116
|
-
ruby: ['3.2']
|
117
|
-
env:
|
118
|
-
RAILS_VERSION: 7.0.8
|
119
|
-
VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
|
120
|
-
steps:
|
121
|
-
- uses: actions/checkout@v2
|
122
|
-
- name: Set up Ruby
|
123
|
-
uses: ruby/setup-ruby@v1
|
124
|
-
with:
|
125
|
-
ruby-version: ${{ matrix.ruby }}
|
126
|
-
bundler: 'default'
|
127
|
-
- name: Install dependencies
|
128
|
-
run: bundle install
|
129
|
-
- name: Run tests
|
130
|
-
run: bundle exec rake ci
|
131
|
-
env:
|
132
|
-
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test'
|
133
|
-
api_test:
|
134
|
-
runs-on: ubuntu-latest
|
135
|
-
strategy:
|
136
|
-
matrix:
|
137
|
-
ruby: [2.7, '3.0']
|
138
|
-
env:
|
139
|
-
RAILS_VERSION: 7.0.8
|
140
|
-
steps:
|
141
|
-
- uses: actions/checkout@v2
|
142
|
-
- name: Set up Ruby
|
143
|
-
uses: ruby/setup-ruby@v1
|
144
|
-
with:
|
145
|
-
bundler: 'default'
|
146
|
-
ruby-version: ${{ matrix.ruby }}
|
147
|
-
- name: Install dependencies
|
148
|
-
run: bundle install
|
149
|
-
- name: Run tests
|
150
|
-
run: bundle exec rake ci
|
151
|
-
env:
|
152
|
-
BLACKLIGHT_API_TEST: true
|
153
|
-
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'
|
154
|
-
docker_build:
|
155
|
-
runs-on: ubuntu-latest
|
156
|
-
steps:
|
157
|
-
- uses: actions/checkout@v3
|
158
|
-
- name: Build docker image
|
159
|
-
run: docker compose build app
|