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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf6f2c77b039ffcb18b23c50795dd2acd9dd410e50749422a55a2d6b7f85d9aa
4
- data.tar.gz: f5edad3ff59994077cbe368027d5af44ed1284cad8d561b8dba46e12a82a0688
3
+ metadata.gz: bf15f6dbb817f0839a3b5729997535274d21043ff834b4882cbd50af5ad37f05
4
+ data.tar.gz: 57101760654230e5c50eaae71bdaf2fc679230d2ed739ad2023a1f48cea7a2ea
5
5
  SHA512:
6
- metadata.gz: 4f8630de40970d3cd1422168e292445057172b55942eebd6fccbda3ca6be8141c89b9981ee459880b8185482d4c37d957803bcc610b87afa612876760085439d
7
- data.tar.gz: 90e98ba147b335d833ca80b139776b89c622c18184a59e8c19083fa0b651983206ab209aa3b0429a673b34781a9cdfcc53dc6b12bafeaf74e4da575a00cd2151
6
+ metadata.gz: bd8d458da8677de400d1e96104fbb0d0831ba674a1d1790dbfcdf2b4e939cc270dc6b263f48d20e2ddd309f5cff7a312d003d573cb4ab5b9455ecd970c8caa99
7
+ data.tar.gz: f2f66d799ca0c97a97705fb8d9d7f71ac2f374a9d0f69ecf02e620a5223ee1a72054b3911c8025959276a26bb71d6b852d3ab196d7b151d1d5aea3964a720e93
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.0.0.beta8
1
+ 8.0.0
@@ -1,3 +1,3 @@
1
- //= link_tree ../../images
1
+ //= link_tree ../../images .png
2
2
  //= link_directory ../../stylesheets .css
3
3
  //= link_tree ../../../javascript .js
@@ -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
- <%= link_to application_name, blacklight_config.logo_link, class: 'mb-0 navbar-brand navbar-logo' %>
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
- <% if show_doc_actions? %>
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-beta.8",
3
+ "version": "8.0.0",
4
4
  "description": "[![Build Status](https://travis-ci.com/projectblacklight/blacklight.png?branch=main)](https://travis-ci.com/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Coverage Status](https://coveralls.io/repos/github/projectblacklight/blacklight/badge.svg?branch=main)](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 match_array([{ "value" => "Book", "hits" => 30, "label" => "Book" }])
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 match_array [:b, :a, :c]
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 match_array [:b, :a, :c]
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 match_array [1, 2, 3]
176
- expect(config_copy.b).to match_array [1, 2, 3, 5]
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 match_array [:a, :b, :c, :d]
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 match_array [:a, :b, :c, :d, :e]
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 match_array [:a, :c, :e]
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 match_array ['this is my query', 'another:query']
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 match_array ['some query', 'also required']
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 __vc_test_helpers_controller if defined?(__vc_test_helpers_controller)
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::ActionsComponent) }
6
+ let(:component) { instance_double(Blacklight::Document::ShowToolsComponent) }
7
7
 
8
8
  before do
9
- allow(Blacklight::Document::ActionsComponent).to receive(:new).and_return(component)
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 match_array [{ value: 'Book', hits: 30, label: 'Book' }]
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.beta8
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-02-27 00:00:00.000000000 Z
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: 1.3.1
935
+ version: '0'
933
936
  requirements: []
934
- rubygems_version: 3.3.26
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