Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(*args, block: nil, **kwargs)
end

def before_render
with_embed(block_context) unless embed
with_embed(block_context: block_context) unless embed

super
end
Expand Down
6 changes: 1 addition & 5 deletions app/models/spotlight/blacklight_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ def blacklight_config
config.default_per_page = default_per_page if default_per_page

config.view.embed!
# This is blacklight-gallery's openseadragon partial
unless config.view.embed.document_component
config.view.embed.partials ||= ['openseadragon']
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent
end
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent unless config.view.embed.document_component
config.view.embed.if = false

# blacklight-gallery requires tile_source_field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new(document: document_presenter(document, view_config: view_config), counter: nil, block: local_assigns[:block]) do |component| %>
<% component.with_partial do %>
<%= render_document_partials document, view_config.partials, component: component, document_counter: nil, view_config: view_config, block: local_assigns[:block], **(view_config.locals) %>
<% end if view_config&.partials&.any? %>
<% end if Blacklight.version < '9.0' && view_config&.partials&.any? %>
<% end %>
</div>
6 changes: 5 additions & 1 deletion spec/test_app_templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ class CatalogController < ApplicationController
# config.view.gallery.classes = 'row-cols-2 row-cols-md-3'
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)
config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)
config.view.embed(if: false,
partials: [],
document_component: Spotlight::SolrDocumentLegacyEmbedComponent,
embed_component: Blacklight::Gallery::OpenseadragonEmbedComponent)
config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
config.show.partials.insert(1, :openseadragon)
config.show.embed_component = Blacklight::Gallery::OpenseadragonEmbedComponent
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
config.default_solr_params = {
qt: 'search',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@
end

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

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