Skip to content

Commit b2e6389

Browse files
committed
Stop using show.partials.insert
1 parent 1ee1a51 commit b2e6389

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

app/components/spotlight/solr_document_legacy_embed_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def initialize(*args, block: nil, **kwargs)
1212
end
1313

1414
def before_render
15-
with_embed(block_context) unless embed
15+
with_embed(block_context: block_context) unless embed
1616

1717
super
1818
end

app/models/spotlight/blacklight_configuration.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ def blacklight_config
121121
config.default_per_page = default_per_page if default_per_page
122122

123123
config.view.embed!
124-
# This is blacklight-gallery's openseadragon partial
125-
unless config.view.embed.document_component
126-
config.view.embed.partials ||= ['openseadragon']
127-
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent
128-
end
124+
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent unless config.view.embed.document_component
129125
config.view.embed.if = false
130126

131127
# blacklight-gallery requires tile_source_field

app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new(document: document_presenter(document, view_config: view_config), counter: nil, block: local_assigns[:block]) do |component| %>
44
<% component.with_partial do %>
55
<%= render_document_partials document, view_config.partials, component: component, document_counter: nil, view_config: view_config, block: local_assigns[:block], **(view_config.locals) %>
6-
<% end if view_config&.partials&.any? %>
6+
<% end if Blacklight.version < '9.0' && view_config&.partials&.any? %>
77
<% end %>
88
</div>

spec/test_app_templates/catalog_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ class CatalogController < ApplicationController
1212
# config.view.gallery.classes = 'row-cols-2 row-cols-md-3'
1313
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)
1414
config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)
15+
config.view.embed(if: false,
16+
partials: [],
17+
document_component: Spotlight::SolrDocumentLegacyEmbedComponent,
18+
embed_component: Blacklight::Gallery::OpenseadragonEmbedComponent)
1519
config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
16-
config.show.partials.insert(1, :openseadragon)
20+
config.show.embed_component = Blacklight::Gallery::OpenseadragonEmbedComponent
1721
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
1822
config.default_solr_params = {
1923
qt: 'search',

spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
end
3434

3535
it 'has a embed block' do
36-
expect(view).to receive(:render_document_partials).with(doc, %w[a b c], hash_including(a: 1, block:)).and_return('OSD')
3736
render partial: p, locals: { solr_documents_embed_block: block }
3837
expect(rendered).to have_selector 'h3', text: 'Some title'
3938
expect(rendered).to have_content 'Some text'
40-
expect(rendered).to have_selector '.box', text: 'OSD'
39+
expect(rendered).to have_selector '.box'
4140
expect(rendered).to have_selector '.items-col'
4241
expect(rendered).to have_selector '.text-col'
4342
expect(rendered).to have_no_selector '.col-md-12'
@@ -49,7 +48,6 @@
4948
end
5049

5150
it 'does not have a two column layout' do
52-
expect(view).to receive(:render_document_partials).with(doc, %w[a b c], hash_including(a: 1, block:)).and_return('OSD')
5351
render partial: p, locals: { solr_documents_embed_block: block }
5452
expect(rendered).to have_selector '.col-md-12'
5553
expect(rendered).to have_selector '.items-col h3', text: 'Some title'

0 commit comments

Comments
 (0)