Skip to content

Commit e18b705

Browse files
authored
Merge pull request #3321 from projectblacklight/remove-show-tools-partial
Remove deprecated show tools partial
2 parents bd2d03c + f60be9b commit e18b705

File tree

6 files changed

+11
-73
lines changed

6 files changed

+11
-73
lines changed

app/components/blacklight/document/sidebar_component.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ def initialize(presenter:)
1616

1717
private
1818

19-
def render_show_tools
20-
blacklight_config.view_config(:show).show_tools_component&.tap do |show_tools_component_class|
21-
return render show_tools_component_class.new(document: document)
22-
end
19+
def show_tools_component_class
20+
blacklight_config.view_config(:show).show_tools_component
21+
end
2322

24-
render 'show_tools', document: document, silence_deprecation: helpers.partial_from_blacklight?('show_tools')
23+
def render_show_tools
24+
render show_tools_component_class.new(document: document)
2525
end
2626
end
2727
end

app/helpers/blacklight/blacklight_helper_behavior.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,4 @@ def with_format(format)
4141
def self.blacklight_gem_path
4242
@blacklight_gem_path ||= Gem.loaded_specs["blacklight"].full_gem_path
4343
end
44-
45-
def partial_from_blacklight?(partial)
46-
path = lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
47-
48-
path.nil? ? false : path.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_gem_path)
49-
end
5044
end

app/views/catalog/_show_tools.html.erb

Lines changed: 0 additions & 2 deletions
This file was deleted.

lib/blacklight/configuration.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ def initialized_default_configuration?
183183
# document presenter class used by helpers and views
184184
document_presenter_class: nil,
185185
document_component: Blacklight::DocumentComponent,
186-
# in Blacklight 9, the default show_tools_component configuration will
187-
# be Blacklight::Document::ShowToolsComponent
188-
show_tools_component: nil,
186+
show_tools_component: Blacklight::Document::ShowToolsComponent,
189187
show_header_tools_component: nil,
190188
document_header_component: Blacklight::Document::PageHeaderComponent,
191189
sidebar_component: Blacklight::Document::SidebarComponent,

spec/components/blacklight/document/sidebar_component_spec.rb

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,14 @@
3333
# rubocop:disable RSpec/SubjectStub
3434
before do
3535
allow(component).to receive(:render).with(an_instance_of(Blacklight::Document::MoreLikeThisComponent)).and_return("")
36+
blacklight_config.show.show_tools_component = show_tools_component
37+
allow(component).to receive(:render).with(an_instance_of(show_tools_component)).and_return(expected_html)
3638
end
3739

38-
context "without a configured ShowTools component" do
39-
before do
40-
allow(component).to receive(:render).with('show_tools', document: presented_document, silence_deprecation: false).and_return(expected_html)
41-
end
40+
let(:show_tools_component) { Class.new(Blacklight::Document::ShowToolsComponent) }
4241

43-
it 'renders show_tools partial' do
44-
expect(rendered).to have_css 'div[@class="expected-show_tools"]'
45-
end
46-
end
47-
48-
context "with a configured ShowTools component" do
49-
let(:show_tools_component) { Class.new(Blacklight::Document::ShowToolsComponent) }
50-
51-
before do
52-
blacklight_config.show.show_tools_component = show_tools_component
53-
allow(component).to receive(:render).with(an_instance_of(show_tools_component)).and_return(expected_html)
54-
end
55-
56-
it 'renders configured show_tools component' do
57-
expect(rendered).to have_css 'div[@class="expected-show_tools"]'
58-
end
42+
it 'renders configured show_tools component' do
43+
expect(rendered).to have_css 'div[@class="expected-show_tools"]'
5944
end
6045
# rubocop:enable RSpec/SubjectStub
6146
end

spec/views/catalog/_show_tools.html.erb_spec.rb

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)