noesya/osuny

View on GitHub
app/views/admin/communication/blocks/_block.html.erb

Summary

Maintainability
Test Coverage
<div  id="block-<%= block.id %>"
      class=" content-editor__elements__element
              js-content-editor-element"
      data-id="<%= block.id %>"
      data-kind="block">
  <div class="row">
    <div class="col-lg-4 text-lg-end pt-2">
      <%= osuny_label block.template_kind_i18n %>
    </div>
    <div class="col-lg-8 col-xxl-6">
      <article class="card
                      card-body
                      px-3
                      px-sm-5
                      border-bottom
                      border-light
                      <%= 'draft' unless block.published? %>">
        <div class="text-end mb-2">
          <span class="content-editor__elements__element--hover">
            <% if can?(:update, block) %>
              <span class="content-editor__elements__handle">
                <span class="handle">
                  <i class="<%= Icon::SORT %>"></i>
                  <span class="small"><%= t 'move' %></span>
                </span>
              </span>
            <% end %>
            <%= destroy_link block, html_classes: 'action text-danger ms-2' %>
            <%= link_to t('admin.communication.contents.blocks.copy'),
                        copy_admin_communication_block_path(block),
                        class: 'action ms-2',
                        remote: true %>
            <%= duplicate_link block, html_classes: 'action ms-2' %>
          </span>
          <% if can?(:update, block) %>
            <%= link_to t('edit'), 
                        edit_admin_communication_block_path(block),
                        class: 'action ms-2 js-content-editor__element__edit' %>
          <% end %>
        </div>
        <% if block.empty? %>
          <span class="small text-danger mb-2">
            <%= t('admin.communication.blocks.empty') %>
          </span>
        <% end %>
        <div class="content-editor__elements__preview
                    content-editor__elements__preview--<%= block.template_kind %>">
          <div id="snippet-<%= block.id %>">
            <%= render 'admin/communication/blocks/block_snippet', block: block %>
          </div>
        </div>
        <%= render 'admin/application/a11y/status', about: block %>
      </article>
    </div>
  </div>
</div>