noesya/osuny

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

Summary

Maintainability
Test Coverage
<%= block_component_edit block, :description, summernote_config: 'mini' %>

<%= osuny_separator %>

<draggable  class="row g-3 mb-3" 
            :list="data.elements" 
            handle=".dragHandle">
  <div v-for="(element, index) in data.elements" class=" col-6 col-md-4">
    <div class="card draggable-item dragHandle m-0">
      <div class="card-body">
        <a>
          <i class="<%= Icon::MOVE %> handle"></i>
          {{ element.title }}
        </a>
      </div>
    </div>
  </div>
</draggable>

<%= osuny_separator %>

<%= block_component_add_element block, t('.add_element') %>
<div v-for="(element, index) in data.elements" class="row mb-4">
  <div class="col-sm-4">
    <%= block_component_edit block, :image, template: @element %>
    <a  class="btn btn-sm text-danger"
        v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"
        title="<%= t '.remove_element' %>">
        <i class="<%= Icon::DELETE %>"></i>
        <%= t '.remove_element' %>
    </a>
  </div>
  <div class="col-sm-8">
    <%= block_component_edit block, :title, template: @element %>
    <%= block_component_edit block, :description, template: @element, summernote_config: 'mini' %>
    <div v-show="element.image.id">
      <%= block_component_edit block, :alt, template: @element %>
      <%= block_component_edit block, :credit, template: @element, summernote_config: 'mini' %>
    </div>
  </div>
</div>
<div v-show="data.elements.length > 2">
  <%= block_component_add_element block, t('.add_element') %>
</div>