From 8bbe38289274d2ba1ed6fa6d07a3ff2ddaabb8c4 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 12 Oct 2022 07:48:09 -0500 Subject: [PATCH] Extract CollectionComponent and NonCollectionComponent from DocumentComponent This eliminates a number of conditionals around whether the document is a collection or not. --- ...html.erb => collection_component.html.erb} | 54 +++++------- .../arclight/collection_component.rb | 13 +++ app/components/arclight/document_component.rb | 18 ++-- .../non_collection_component.html.erb | 88 +++++++++++++++++++ .../arclight/non_collection_component.rb | 16 ++++ app/presenters/arclight/show_presenter.rb | 1 + 6 files changed, 150 insertions(+), 40 deletions(-) rename app/components/arclight/{document_component.html.erb => collection_component.html.erb} (61%) create mode 100644 app/components/arclight/collection_component.rb create mode 100644 app/components/arclight/non_collection_component.html.erb create mode 100644 app/components/arclight/non_collection_component.rb diff --git a/app/components/arclight/document_component.html.erb b/app/components/arclight/collection_component.html.erb similarity index 61% rename from app/components/arclight/document_component.html.erb rename to app/components/arclight/collection_component.html.erb index 9b977e50e..9f16252fd 100644 --- a/app/components/arclight/document_component.html.erb +++ b/app/components/arclight/collection_component.html.erb @@ -13,9 +13,6 @@ <%= render Arclight::DocumentActionsComponent.new(presenter: presenter) %> - -<%= render Arclight::MetadataSectionComponent.with_collection(blacklight_config.show.component_metadata_partials || [], metadata_attr: { layout: Arclight::UpperMetadataLayoutComponent }, presenter: presenter, classes: ['al-metadata-section', 'breadcrumb-item', "breadcrumb-item-#{document.parents.length + 3}"]) unless document.collection? %> -
<%= embed %> @@ -27,25 +24,20 @@