noesya/osuny

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

Summary

Maintainability
Test Coverage
<div class="row pure__row--small">
  <div class="col-xl-6">
    <%= block_component_edit block, :description, summernote_config: 'mini' %>
  </div>
</div>
<div class="row pure__row--small">
  <div class="col-xl-6">
    <%= block_component_edit block, :mode %>
    <div v-if="data.mode === 'category'">
      <%= block_component_edit block, :category_id %>
    </div>
  </div>
  <div class="col-xl-6">
    <%= osuny_label t('admin.communication.blocks.display_options.title') %>
    <%= block_component_edit block, :option_image %>
    <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %>
    <%= block_component_edit block, :option_link %>
    <div v-if="data.mode === 'selection'">
      <%= block_component_edit block, :alphabetical %>
    </div>
  </div>
</div>

<div v-if="data.mode === 'selection'">
  <div><%= osuny_label University::Person.model_name.human(count: 2) %></div>
  <%= block_component_add_element block, t('.add_person') %>
  <draggable :list="data.elements" class="mb-3" handle=".dragHandle">
    <div v-for="(element, index) in data.elements" class="draggable-item">
      <div class="d-flex">
        <div>
          <a class="btn ps-0 dragHandle" title="<%= t('admin.communication.block.drag_and_drop') %>">
            <i class="<%= Icon::DRAG %> handle"></i>
          </a>
        </div>
        <div class="flex-fill">
          <div class="row pure__row--small mb-n3">
            <div class="col-md-6">
              <%= block_component_edit block, :id, template: @element, label: '' %>
            </div>
            <div class="col-md-6">
              <%= block_component_edit block, :role, template: @element, label: '' %>
            </div>
          </div>
        </div>
        <div>
          <a  class="btn btn-sm text-danger"
              v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"
              title="<%= t('delete') %>">
              <i class="<%= Icon::DELETE %>"></i>
          </a>
        </div>
      </div>
    </div>
  </draggable>
  <div v-show="data.elements.length > 2">
    <%= block_component_add_element block, t('.add_person') %>
  </div>
</div>