Skip to content

Commit

Permalink
Set the document_component default value
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Nov 16, 2021
1 parent 22b6ab8 commit 7093a4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/views/catalog/_document.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% # container for a single doc -%>
<% view_config = local_assigns[:view_config] || blacklight_config.view_config(document_index_view_type) %>
<%= render (view_config.document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) do |component| %>
<%= render view_config.document_component.new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) do |component| %>
<% component.public_send(view_config.document_component.blank? && view_config.partials.any? ? :body : :partial) do %>
<%= render_document_partials document, view_config.partials, component: component, document_counter: document_counter %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/_show_main_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% @page_title = t('blacklight.search.show.title', document_title: document_presenter(@document).html_title, application_name: application_name).html_safe %>
<% content_for(:head) { render_link_rel_alternates } %>
<%= render (blacklight_config.view_config(:show).document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(@document), component: :div, title_component: :h1, show: true) do |component| %>
<%= render (blacklight_config.view_config(:show).document_component).new(presenter: document_presenter(@document), component: :div, title_component: :h1, show: true) do |component| %>
<% component.footer do %>
<% if @document.respond_to?(:export_as_openurl_ctx_kev) %>
<!-- COinS, for Zotero among others. -->
Expand Down
7 changes: 3 additions & 4 deletions lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ def default_values
index: ViewConfig::Index.new(
# document presenter class used by helpers and views
document_presenter_class: nil,
# component class used to render a document; defaults to Blacklight::DocumentComponent,
# but can be set explicitly to avoid any legacy behavior
document_component: nil,
# component class used to render a document
document_component: Blacklight::DocumentComponent,
# solr field to use to render a document title
title_field: nil,
# solr field to use to render format-specific partials
Expand All @@ -87,7 +86,7 @@ def default_values
show: ViewConfig::Show.new(
# document presenter class used by helpers and views
document_presenter_class: nil,
document_component: nil,
document_component: Blacklight::DocumentComponent,
display_type_field: nil,
# Default route parameters for 'show' requests.
# Set this to a hash with additional arguments to merge into the route,
Expand Down

0 comments on commit 7093a4c

Please sign in to comment.