noesya/osuny

View on GitHub
app/views/admin/communication/blocks/components/image/_show.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"
without_text = local_assigns[:without_text] || false
%>

<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>
    <% if component.template.try(:text).present? && !without_text %>
      <p><%= sanitize component.template.text %></p>
    <% end %>
    <% if component.template.try(:credit).present? %>
      <div class="credit"><%= sanitize component.template.credit %></div>
    <% end %>
  </figcaption>
</figure>