noesya/osuny

View on GitHub
app/views/admin/communication/blocks/templates/organizations/_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_logo %>
    <%= 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>
<%= block_component_edit block, :layout %>

<div v-if="data.mode === 'selection'">
  <div><%= osuny_label University::Organization.model_name.human(count: 2) %></div>
  <%= block_component_add_element block, t('.add_organization') %>
  <draggable :list="data.elements" class="mb-3" handle=".partnerHandle">
    <div v-for="(element, index) in data.elements" class="draggable-item">
      <div class="d-flex mb-n3">
        <div>
          <a class="btn ps-0 partnerHandle">
            <i class="<%= Icon::DRAG %> handle"></i>
          </a>
        </div>
        <div class="flex-fill">
          <div class="row pure__row--small">
            <div class="col-md-6 mb-n2">
              <%= block_component_edit block, :id, template: @element, label: '', class: 'mt-5' %>
            </div>
            <div class="col-md-6" v-if="!element.id">
              <%= block_component_edit block, :name, template: @element %>
              <%= block_component_edit block, :url, template: @element %>
              <%= block_component_edit block, :logo, template: @element %>
            </div>
          </div>
        </div>
        <div>
          <a  class="btn btn-sm text-danger ps-0 ms-3"
              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_organization') %>
  </div>
</div>