-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render embedded documents using components.
- Loading branch information
Showing
7 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
app/components/spotlight/solr_document_legacy_embed_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %> |
7 changes: 7 additions & 0 deletions
7
app/components/spotlight/solr_document_legacy_embed_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
# Render an document suitable for embedding on a feature page. | ||
module Spotlight | ||
class SolrDocumentLegacyEmbedComponent < Blacklight::DocumentComponent | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="box" data-id="<%= document.id %>"> | ||
<% view_config = blacklight_config.view_config(:embed) %> | ||
<%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new((Blacklight.version > '8.0' ? :document : :presenter) => document_presenter(document), counter: nil) 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 %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters