noesya/osuny

View on GitHub
app/views/admin/communication/blocks/templates/volumes/_edit.html.erb

Summary

Maintainability
Test Coverage
<%= block_component_edit block, :mode %>

<div class="row pure__row--small">
  <div v-if="data.mode === 'all'" class="col-lg-3">
    <%= block_component_edit block, :quantity %>
  </div>
</div>

<div class="mb-4" v-if="data.mode == 'selection'">
  <h2 class="h4"><%= t '.selection.title' %></h2>
  <%= block_component_add_element block, t('.selection.add') %>
  <draggable :list="data.elements" handle=".dragHandle">
    <div v-for="(element, index) in data.elements" class="draggable-item">
      <div class="d-flex mb-n3">
        <div>
          <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop">
            <i class="<%= Icon::DRAG %> handle"></i>
          </a>
        </div>
        <div class="flex-fill">
          <%= block_component_edit block, :id, template: @element %>
        </div>
        <div>
          <a  class="btn btn-sm text-danger ms-3"
              v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"
              title="Supprimer">
              <i class="<%= Icon::DELETE %>"></i>
          </a>
        </div>
      </div>
    </div>
  </draggable>
</div>