noesya/osuny

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

Summary

Maintainability
Test Coverage
<div class="row">
  <div class="col-lg-6">
    <%= block_component_edit block, :mode %>
  </div>
  <div class="col-lg-6" v-if="data.mode !== 'categories'">
    <%= osuny_label t('admin.communication.blocks.display_options.title') %>
    <%= block_component_edit block, :option_image, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:featured_image) %>
    <%= block_component_edit block, :option_subtitle, label: Communication::Website::Portfolio::Project::Localization.human_attribute_name(:subtitle) %>
    <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %>
    <%= block_component_edit block, :option_categories, label: Communication::Website::Portfolio::Project.human_attribute_name(:categories) %>
    <%= block_component_edit block, :option_year, label: Communication::Website::Portfolio::Project.human_attribute_name(:year) %>
  </div>
</div>
<div v-if="data.mode !== 'categories'">
  <%= block_component_edit block, :layout %>
</div>
<div class="row pure__row--small">
  <div v-if="data.mode === 'category' || data.mode === 'all'" class="col-lg-3">
    <%= block_component_edit block, :projects_quantity %>
  </div>
  <div v-if="data.mode === 'category'" class="col-lg-9">
    <%= block_component_edit block, :category_id %>
  </div>
</div>
<div v-if="data.mode === 'selection'">
  <%= block_component_add_element block, t('.add') %>
  <draggable :list="data.elements" handle=".dragHandle">
    <div v-for="(element, index) in data.elements" class="d-flex draggable-item">
      <a class="btn ps-0 dragHandle" title="<%= t('admin.communication.block.drag_and_drop') %>">
        <i class="<%= Icon::DRAG %> handle"></i>
      </a>
      <div class="flex-fill">
        <%= block_component_edit block, :id, template: @element %>
      </div>
      <a  class="btn text-danger ms-3"
          v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"
          title="<%= t('delete') %>">
          <i class="<%= Icon::DELETE %>"></i>
      </a>
    </div>
  </draggable>
</div>