noesya/osuny

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

Summary

Maintainability
Test Coverage
<div class="row pure__row--small mb-5">
  <div class="col-xl-6">
    <%= block_component_edit block, :description, summernote_config: 'mini' %>
  </div>
  <div class="col-xl-6" v-if="data.mode !== 'categories'">
    <%= osuny_label t('admin.communication.blocks.display_options.title') %>
    <%= block_component_edit block, :option_image, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:featured_image) %>
    <%= block_component_edit block, :option_subtitle, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:subtitle) %>
    <%= block_component_edit block, :option_summary, label: t('admin.summary.label') %>
    <%= block_component_edit block, :option_dates, label: Communication::Website::Agenda::Event::Localization.human_attribute_name(:dates) %>
    <%= block_component_edit block, :option_categories, label: Communication::Website::Agenda::Event.human_attribute_name(:categories) %>
    <%= block_component_edit block, :option_status, label: Communication::Website::Agenda::Event.human_attribute_name(:status) %>
  </div>
</div>

<div class="row pure__row--small">
  <div class="col-xl-6 mb-3">
    <%= block_component_edit block, :mode %>
  </div>
  <div class="col-xl-6 mb-3" v-show="data.mode != 'selection' && data.mode != 'categories'">
    <%= block_component_edit block, :time %>
  </div>
</div>

<div v-if="data.mode !== 'categories'">
  <div class="mb-3">
    <%= block_component_edit block, :layout %>
  </div>

  <div class="row pure__row--small">
    <div class="col-xl-6 mb-3" v-show="data.mode != 'selection'">
      <%= block_component_edit block, :quantity %>
    </div>
    <div class="col-xl-6 mb-3" v-show="data.mode === 'category'">
      <%= block_component_edit block, :category_id %>
    </div>
  </div>

  <div class="mb-3" v-show="data.mode === 'selection'">
    <%= block_component_add_element block, t('.add_event') %>
    <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="<%= t('admin.communication.block.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="<%= t('delete') %>">
                <i class="<%= Icon::DELETE %>"></i>
            </a>
          </div>
        </div>
      </div>
    </draggable>
  </div>
  <%= block_component_edit block, :no_event_message %>
</div>