noesya/osuny

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

Summary

Maintainability
Test Coverage
<%
block_page = block.template.page
block_page_l10n = block_page&.localization_for(block.language)
%>
<div class="<%= block_html_class(block) %>">
  <div class="container">
    <div class="block-content">
      <% unless block.title.blank? %>
        <div class="top">
          <% if block.template.layout == "cards" || block.template.layout == "list" %>
            <% if block_page_l10n %>
              <p class="block-title"><%= link_to block_page_l10n, block_page_l10n.current_permalink_url_in_website(@website) %></p>
            <% end %>

          <% elsif block.template.layout == "grid" && block_page_l10n && block.template.option_main_summary %>
            <p class="block-title"><%= link_to block.title, block_page_l10n.current_permalink_url_in_website(@website) %></p>
            <p class="description"><%= block_page_l10n&.summary %></p>

          <% else %>
            <p class="block-title"><%= block.title %></p>
          <% end %>

          <% if block.template.layout == "cards" && block.template.option_main_summary && block.data %>
            <div class="description">
              <p><%= block_page_l10n&.summary %></p>
            </div>
          <% end %>
        </div>
        <% if block.template.layout == "list" && block.template.option_main_summary && block.data %>
          <p class="description"><%= block_page_l10n&.summary %></p>
        <% end %>
      <% end %>
      <% if block.data %>
        <%= render 'admin/communication/blocks/partials/layout', block: block, file: __FILE__ %>
      <% end %>
    </div>
  </div>
</div>