Skip to content

Commit

Permalink
Render embedded documents using components.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Sep 23, 2024
1 parent d6ee4f7 commit 78950c8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% if body.present? %>
<%= body %>
<% elsif partials? %>
<% partials.each do |partial| %>
<%= partial %>
<% end %>
<% elsif embed? %>
<%= embed %>
<% elsif thumbnail? %>
<%= thumbnail %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Spotlight
class SolrDocumentLegacyEmbedComponent < Blacklight::DocumentComponent
end
end
5 changes: 4 additions & 1 deletion app/models/spotlight/blacklight_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ def blacklight_config

config.view.embed!
# This is blacklight-gallery's openseadragon partial
config.view.embed.partials ||= ['openseadragon']
unless config.view.embed.document_component
config.view.embed.partials ||= ['openseadragon']
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent
end
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 @@ -16,7 +16,7 @@
<% solr_documents_embed_block.each_document do |block_options, document| %>
<div class="box" data-id="<%= document.id %>">
<% view_config = blacklight_config.view_config(:embed) %>
<%= render_document_partials document, view_config.partials, (view_config.locals || {}).reverse_merge(block: solr_documents_embed_block, view_config: view_config) %>
<%= render partial: '/catalog/document', locals: { block: solr_documents_embed_block, document: document, view_config: view_config, document_counter: 1 } %>
</div>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion blacklight-spotlight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ these collections.)
s.add_dependency 'activejob-status'
s.add_dependency 'acts-as-taggable-on', '>= 5.0', '< 12'
s.add_dependency 'autoprefixer-rails'
s.add_dependency 'blacklight', '>= 7.18', '< 9'
s.add_dependency 'blacklight', '>= 7.19', '< 9'
s.add_dependency 'blacklight-gallery', '>= 3.0', '< 5'
s.add_dependency 'bootstrap_form', '>= 4.1', '< 6'
s.add_dependency 'breadcrumbs_on_rails', '>= 3.0', '< 5'
Expand Down

0 comments on commit 78950c8

Please sign in to comment.