noesya/osuny

View on GitHub
app/views/admin/communication/blocks/components/image/_snippet.html.erb

Summary

Maintainability
Test Coverage
<%
blob = component.blob
return unless blob
is_carousel = block.template.is_a?(Communication::Block::Template::Gallery) && block.template.layout == "carousel"
%>

<figure <% if is_carousel %>class="splide__slide"<% end %>>
  <%= kamifusen_tag blob, width: 600, class: 'img-fluid mb-1', alt: component.template.try(:alt).blank? ? "" : component.template.alt %>
  <figcaption class="small">
    <%= sanitize component.template.credit if component.template.try(:credit).present? %>
  </figcaption>
</figure>