fix: correct alt attribute for image tag
Some checks failed
Docker Dev / docker (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Docker Main / docker (push) Has been cancelled

- Update alt attribute to reference the first item's image_alt
- This change improves accessibility by ensuring the correct
  descriptive text is used if the latest_arts is present.

Prior to this change, there was a risk of displaying an incorrect
description if the latest_arts was empty, which could lead to
confusion for users relying on alt text for context.
This commit is contained in:
songtianlun 2025-04-10 22:47:33 +08:00
parent 4236e1a81d
commit 371b534c48

View File

@ -5,7 +5,7 @@
<div class="absolute inset-0">
<% begin %>
<%= image_tag @latest_arts&.first&.webp_image&.processed,
alt: @latest_arts.image_alt,
alt: @latest_arts&.first&.image_alt,
class: "w-full h-full object-cover" %>
<% rescue StandardError => e %>
<% Rails.logger.error("图片加载失败: #{e.message}") if defined?(Rails) %>