noesya/osuny

View on GitHub
app/views/admin/communication/blocks/templates/links/_show.html.erb

Summary

Maintainability
Test Coverage
<div class="<%= block_html_class(block) %>">
  <div class="container">
    <div class="block-content">
      <%= render 'admin/communication/blocks/partials/top', block: block %>
      <ul class="links">
        <% block.template.elements.each do |element| %>
          <li itemscope itemtype="https://schema.org/WebPage">
            <div class="link-content">
                <% isExternal = true %>
              <% if (element.url.start_with?('/')) %>
                <% isExternal = false %>
              <% end %>
              <link itemprop="url" href="<%= element.url %>">
              <a  href="<%= element.url %>"
                  <% if isExternal %> rel="noopener" target="_blank"<% end %>
                  title="<%= element.alt_title.presence || element.title %>">
                <%= element.title %>
              </a>
              <p><%= element.description %></p>
            </div>
            <div class="media">
              <%= block_component_show block, :image, template: element %>
            </div>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
</div>