From feaf3da06bf7c50967e913fc8a8d7357cc1d948a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 10 Jul 2025 23:56:02 -0700 Subject: [PATCH] fall back to card-headers on content#show headers --- .../content/display/_image_card_header.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/content/display/_image_card_header.html.erb b/app/views/content/display/_image_card_header.html.erb index 52db72bd..baf18b84 100644 --- a/app/views/content/display/_image_card_header.html.erb +++ b/app/views/content/display/_image_card_header.html.erb @@ -16,13 +16,13 @@ preview_image = get_preview_image(regular_images, basil_images) combined_images = preview_image.present? ? [preview_image] : [] - # If we have no images, try to add a default image - if combined_images.empty? && @content.respond_to?(:default_image) - default_image = @content.default_image - if default_image.present? + # If we have no images, add the card-header fallback image + if combined_images.empty? + card_header_path = @content.header_asset_for(@content.class.name) + if card_header_path.present? combined_images << { - type: 'default', - data: default_image + type: 'card_header', + data: card_header_path } end end @@ -42,8 +42,8 @@ <% else %> <%= image_tag asset_path("missing-image.jpg") %> <% end %> - <% elsif image_type == 'default' && image_data.is_a?(String) %> - + <% elsif image_type == 'card_header' && image_data.is_a?(String) %> + <%= image_tag image_data %> <% end %>