blacklight 8.0.0.beta8 → 8.0.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/VERSION +1 -1
- data/app/assets/config/blacklight/manifest.js +1 -1
- data/app/components/blacklight/document/show_tools_component.html.erb +12 -0
- data/app/components/blacklight/document/show_tools_component.rb +23 -0
- data/app/components/blacklight/document_component.rb +1 -1
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.rb +4 -0
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +1 -0
- data/app/views/catalog/_show_tools.html.erb +1 -14
- data/package.json +1 -1
- data/spec/components/blacklight/document_component_spec.rb +20 -0
- data/spec/components/blacklight/header_component_spec.rb +20 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +2 -2
- data/spec/models/blacklight/configuration_spec.rb +2 -2
- data/spec/models/blacklight/search_builder_spec.rb +3 -3
- data/spec/models/blacklight/solr/request_spec.rb +2 -2
- data/spec/support/view_component_test_helpers.rb +1 -1
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -2
- data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf15f6dbb817f0839a3b5729997535274d21043ff834b4882cbd50af5ad37f05
|
4
|
+
data.tar.gz: 57101760654230e5c50eaae71bdaf2fc679230d2ed739ad2023a1f48cea7a2ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd8d458da8677de400d1e96104fbb0d0831ba674a1d1790dbfcdf2b4e939cc270dc6b263f48d20e2ddd309f5cff7a312d003d573cb4ab5b9455ecd970c8caa99
|
7
|
+
data.tar.gz: f2f66d799ca0c97a97705fb8d9d7f71ac2f374a9d0f69ecf02e620a5223ee1a72054b3911c8025959276a26bb71d6b852d3ab196d7b151d1d5aea3964a720e93
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.0.0
|
1
|
+
8.0.0
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="card show-tools">
|
2
|
+
<div class="card-header">
|
3
|
+
<h2 class="mb-0 h6"><%= t('blacklight.tools.title') %></h2>
|
4
|
+
</div>
|
5
|
+
<%= render Blacklight::Document::ActionsComponent.new(document: document,
|
6
|
+
tag: 'ul',
|
7
|
+
classes: 'list-group list-group-flush',
|
8
|
+
wrapping_tag: 'li',
|
9
|
+
wrapping_classes: 'list-group-item list-group-item-action',
|
10
|
+
actions: actions,
|
11
|
+
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
|
12
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Document
|
5
|
+
# Render the tools that display on the sidebar of the show page
|
6
|
+
class ShowToolsComponent < Blacklight::Component
|
7
|
+
# @param [Blacklight::Document] document
|
8
|
+
def initialize(document:)
|
9
|
+
@document = document
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :document
|
13
|
+
|
14
|
+
def render?
|
15
|
+
helpers.show_doc_actions?
|
16
|
+
end
|
17
|
+
|
18
|
+
def actions
|
19
|
+
helpers.document_actions(document)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -37,7 +37,7 @@ module Blacklight
|
|
37
37
|
|
38
38
|
# The document title with some reasonable default behavior
|
39
39
|
renders_one :title, (lambda do |*args, component: nil, **kwargs|
|
40
|
-
component ||= Blacklight::DocumentTitleComponent
|
40
|
+
component ||= @presenter&.view_config&.title_component || Blacklight::DocumentTitleComponent
|
41
41
|
|
42
42
|
component.new(*args, counter: @counter, document: @document, presenter: @presenter, as: @title_component, actions: !@show, link_to_document: !@show, document_component: self, **kwargs)
|
43
43
|
end)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark topbar" role="navigation">
|
2
2
|
<div class="<%= container_classes %>">
|
3
|
-
<%=
|
3
|
+
<%= logo_link %>
|
4
4
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-bs-toggle="collapse" data-target="#user-util-collapse" data-bs-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
5
5
|
<span class="navbar-toggler-icon"></span>
|
6
6
|
</button>
|
@@ -9,5 +9,9 @@ module Blacklight
|
|
9
9
|
attr_reader :blacklight_config
|
10
10
|
|
11
11
|
delegate :application_name, :container_classes, to: :helpers
|
12
|
+
|
13
|
+
def logo_link(title: application_name)
|
14
|
+
link_to title, blacklight_config.logo_link, class: 'mb-0 navbar-brand navbar-logo'
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
@@ -59,6 +59,7 @@ render document_component.new(presenter: document_presenter(document), component
|
|
59
59
|
if template
|
60
60
|
template.render(self, locals.merge(document: doc))
|
61
61
|
else
|
62
|
+
logger.warn("No template was found for base_name: '#{base_name}', view_type: '#{view_type}' in render_document_partial")
|
62
63
|
''
|
63
64
|
end
|
64
65
|
end
|
@@ -1,14 +1 @@
|
|
1
|
-
|
2
|
-
<div class="card show-tools">
|
3
|
-
<div class="card-header">
|
4
|
-
<h2 class="mb-0 h6"><%= t('blacklight.tools.title') %></h2>
|
5
|
-
</div>
|
6
|
-
<%= render Blacklight::Document::ActionsComponent.new(document: document,
|
7
|
-
tag: 'ul',
|
8
|
-
classes: 'list-group list-group-flush',
|
9
|
-
wrapping_tag: 'li',
|
10
|
-
wrapping_classes: 'list-group-item list-group-item-action',
|
11
|
-
actions: document_actions(document),
|
12
|
-
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h)) %>
|
13
|
-
</div>
|
14
|
-
<% end %>
|
1
|
+
<%= render Blacklight::Document::ShowToolsComponent.new(document: document) %>
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
|
-
"version": "8.0.0
|
3
|
+
"version": "8.0.0",
|
4
4
|
"description": "[](https://travis-ci.com/projectblacklight/blacklight) [](http://badge.fury.io/rb/blacklight) [](https://coveralls.io/github/projectblacklight/blacklight?branch=main)",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
6
|
"module": "app/assets/javascripts/blacklight/blacklight.esm.js",
|
@@ -181,6 +181,26 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
|
|
181
181
|
expect(rendered).to have_text 'blah'
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
context 'with configured title component' do
|
186
|
+
let(:custom_component_class) do
|
187
|
+
Class.new(Blacklight::DocumentTitleComponent) do
|
188
|
+
# Override component rendering with our own value
|
189
|
+
def call
|
190
|
+
'Titleriffic'
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
before do
|
196
|
+
stub_const('MyTitleComponent', custom_component_class)
|
197
|
+
blacklight_config.show.title_component = MyTitleComponent
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'renders custom component' do
|
201
|
+
expect(rendered).to have_text 'Titleriffic'
|
202
|
+
end
|
203
|
+
end
|
184
204
|
end
|
185
205
|
|
186
206
|
it 'renders partials' do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Blacklight::HeaderComponent, type: :component do
|
4
|
+
before do
|
5
|
+
with_controller_class(CatalogController) do
|
6
|
+
allow(controller).to receive(:current_user).and_return(nil)
|
7
|
+
allow(controller).to receive(:search_action_url).and_return('/search')
|
8
|
+
render
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'with no slots' do
|
13
|
+
let(:render) { render_inline(described_class.new(blacklight_config: CatalogController.blacklight_config)) }
|
14
|
+
|
15
|
+
it 'draws the topbar' do
|
16
|
+
expect(page).to have_css 'nav.topbar'
|
17
|
+
expect(page).to have_link 'Blacklight', href: '/'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -158,7 +158,7 @@ RSpec.describe CatalogController, api: true do
|
|
158
158
|
|
159
159
|
format = facets.find { |x| x['id'] == 'format' }
|
160
160
|
|
161
|
-
expect(format['attributes']['items'].pluck('attributes')).to
|
161
|
+
expect(format['attributes']['items'].pluck('attributes')).to contain_exactly({ "value" => "Book", "hits" => 30, "label" => "Book" })
|
162
162
|
expect(format['links']['self']).to eq facet_catalog_url(format: :json, id: 'format')
|
163
163
|
expect(format['attributes']['items'].first['links']['self']).to eq search_catalog_url(format: :json, f: { format: ['Book'] })
|
164
164
|
end
|
@@ -76,7 +76,7 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
|
|
76
76
|
|
77
77
|
it "sorts the underlying hash" do
|
78
78
|
sorted = subject.sort_by { |_k, v| v }
|
79
|
-
expect(sorted.keys).to
|
79
|
+
expect(sorted.keys).to contain_exactly(:b, :a, :c)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,7 +85,7 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
|
|
85
85
|
|
86
86
|
it "sorts the underlying hash" do
|
87
87
|
subject.sort_by! { |_k, v| v }
|
88
|
-
expect(subject.keys).to
|
88
|
+
expect(subject.keys).to contain_exactly(:b, :a, :c)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -172,8 +172,8 @@ RSpec.describe "Blacklight::Configuration", api: true do
|
|
172
172
|
|
173
173
|
expect(config.a[:value]).to eq 1
|
174
174
|
expect(config_copy.a[:value]).to eq 2
|
175
|
-
expect(config.b).to
|
176
|
-
expect(config_copy.b).to
|
175
|
+
expect(config.b).to contain_exactly(1, 2, 3)
|
176
|
+
expect(config_copy.b).to contain_exactly(1, 2, 3, 5)
|
177
177
|
expect(config.c.value).to match_array %w[a b]
|
178
178
|
expect(config_copy.c.value).to match_array %w[a b c]
|
179
179
|
end
|
@@ -45,7 +45,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
45
45
|
|
46
46
|
it "is mutable" do
|
47
47
|
subject.processor_chain.insert(-1, :d)
|
48
|
-
expect(subject.processor_chain).to
|
48
|
+
expect(subject.processor_chain).to contain_exactly(:a, :b, :c, :d)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -56,7 +56,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
56
56
|
builder = subject.append(:d, :e)
|
57
57
|
expect(subject.processor_chain).to eq processor_chain
|
58
58
|
expect(builder.processor_chain).not_to eq subject.processor_chain
|
59
|
-
expect(builder.processor_chain).to
|
59
|
+
expect(builder.processor_chain).to contain_exactly(:a, :b, :c, :d, :e)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -68,7 +68,7 @@ RSpec.describe Blacklight::SearchBuilder, api: true do
|
|
68
68
|
expect(builder).not_to equal(subject)
|
69
69
|
expect(subject.processor_chain).to eq processor_chain
|
70
70
|
expect(builder.processor_chain).not_to eq subject.processor_chain
|
71
|
-
expect(builder.processor_chain).to
|
71
|
+
expect(builder.processor_chain).to contain_exactly(:a, :c, :e)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -45,7 +45,7 @@ RSpec.describe Blacklight::Solr::Request, api: true do
|
|
45
45
|
subject.append_query 'this is my query'
|
46
46
|
subject.append_query 'another:query'
|
47
47
|
expect(subject).not_to have_key 'q'
|
48
|
-
expect(subject.dig('json', 'query', 'bool', 'must')).to
|
48
|
+
expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('this is my query', 'another:query')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -62,7 +62,7 @@ RSpec.describe Blacklight::Solr::Request, api: true do
|
|
62
62
|
subject['q'] = 'some query'
|
63
63
|
subject.append_boolean_query :must, 'also required'
|
64
64
|
|
65
|
-
expect(subject.dig('json', 'query', 'bool', 'must')).to
|
65
|
+
expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('some query', 'also required')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -14,7 +14,7 @@ module ViewComponentTestHelpers
|
|
14
14
|
return super if defined?(super)
|
15
15
|
|
16
16
|
# ViewComponent 3.x
|
17
|
-
return
|
17
|
+
return vc_test_controller if defined?(vc_test_controller)
|
18
18
|
|
19
19
|
ApplicationController.new.extend(Rails.application.routes.url_helpers)
|
20
20
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
RSpec.describe "catalog/_show_tools.html.erb" do
|
4
4
|
let(:document) { SolrDocument.new id: 'xyz', format: 'a' }
|
5
5
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
6
|
-
let(:component) { instance_double(Blacklight::Document::
|
6
|
+
let(:component) { instance_double(Blacklight::Document::ShowToolsComponent) }
|
7
7
|
|
8
8
|
before do
|
9
|
-
allow(Blacklight::Document::
|
9
|
+
allow(Blacklight::Document::ShowToolsComponent).to receive(:new).and_return(component)
|
10
10
|
allow(view).to receive(:render).with(component)
|
11
11
|
allow(view).to receive(:render).with('catalog/show_tools', { document: document }).and_call_original
|
12
12
|
allow(view).to receive(:blacklight_config).and_return blacklight_config
|
@@ -93,7 +93,7 @@ RSpec.describe "catalog/index.json", api: true do
|
|
93
93
|
expect(facets.pluck('id')).to include 'format'
|
94
94
|
expect(format['links']).to include self: 'http://test.host/some/facet/url'
|
95
95
|
expect(format['attributes']['label']).to eq 'Format'
|
96
|
-
expect(format_item_attributes).to
|
96
|
+
expect(format_item_attributes).to contain_exactly({ value: 'Book', hits: 30, label: 'Book' })
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
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.0.0
|
4
|
+
version: 8.0.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: 2023-
|
20
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -423,6 +423,8 @@ files:
|
|
423
423
|
- app/components/blacklight/document/group_component.rb
|
424
424
|
- app/components/blacklight/document/more_like_this_component.html.erb
|
425
425
|
- app/components/blacklight/document/more_like_this_component.rb
|
426
|
+
- app/components/blacklight/document/show_tools_component.html.erb
|
427
|
+
- app/components/blacklight/document/show_tools_component.rb
|
426
428
|
- app/components/blacklight/document/sidebar_component.html.erb
|
427
429
|
- app/components/blacklight/document/sidebar_component.rb
|
428
430
|
- app/components/blacklight/document/thumbnail_component.html.erb
|
@@ -776,6 +778,7 @@ files:
|
|
776
778
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
777
779
|
- spec/components/blacklight/facet_item_component_spec.rb
|
778
780
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
781
|
+
- spec/components/blacklight/header_component_spec.rb
|
779
782
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
780
783
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
781
784
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
@@ -927,11 +930,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
927
930
|
version: '2.7'
|
928
931
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
929
932
|
requirements:
|
930
|
-
- - "
|
933
|
+
- - ">="
|
931
934
|
- !ruby/object:Gem::Version
|
932
|
-
version:
|
935
|
+
version: '0'
|
933
936
|
requirements: []
|
934
|
-
rubygems_version: 3.
|
937
|
+
rubygems_version: 3.1.6
|
935
938
|
signing_key:
|
936
939
|
specification_version: 4
|
937
940
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -949,6 +952,7 @@ test_files:
|
|
949
952
|
- spec/components/blacklight/facet_field_list_component_spec.rb
|
950
953
|
- spec/components/blacklight/facet_item_component_spec.rb
|
951
954
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
955
|
+
- spec/components/blacklight/header_component_spec.rb
|
952
956
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
953
957
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
954
958
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|