noesya/osuny

View on GitHub
app/views/admin/communication/contents/_editor.html.erb

Summary

Maintainability
Test Coverage
<%
mode_expert = about.large_number_of_blocks?
%>

<div  class="js-content-editor mb-5"
      data-sort-url="<%= reorder_admin_communication_blocks_path(website_id: nil, extranet_id: nil) %>">
  <% if mode_expert %>
    <div class="row">
      <div class="offset-lg-4 col-lg-8 col-xxl-6">
        <ul class="nav nav-tabs justify-content-end">
          <li class="nav-item small">
            <a  class="nav-link active" 
                id="mode-write-tab"
                data-bs-toggle="tab" 
                data-bs-target="#mode-write" 
                type="button" 
                role="tab" 
                aria-controls="mode-write" 
                aria-selected="true">
              <%= t('admin.communication.contents.modes.write.tab') %>
            </a>
          </li>
          <li class="nav-item small">
            <a  class="nav-link"
                id="mode-structure-tab"
                data-bs-toggle="tab" 
                data-bs-target="#mode-structure" 
                type="button" 
                role="tab" 
                aria-controls="mode-structure" 
                aria-selected="false">
              <%= t('admin.communication.contents.modes.structure.tab') %>
            </a>
          </li>
        </ul>
      </div>
    </div>
  <% end %>
  <div class="tab-content">
    <div  class="tab-pane show active" 
          id="mode-write" 
          data-source="<%= admin_communication_contents_write_path(about_type: about.class.polymorphic_name, about_id: about.id) %>"
          data-target="#mode-write-container"
          role="tabpanel" 
          aria-labelledby="mode-write-tab"
          tabindex="0">
      <div id="mode-write-container" class="mt-3">
        <%= render 'admin/communication/contents/write', about: about %>
      </div>
    </div>
    <div  class="tab-pane" 
          id="mode-structure" 
          data-source="<%= admin_communication_contents_structure_path(about_type: about.class.polymorphic_name, about_id: about.id) %>"
          data-target="#mode-structure-container"
          role="tabpanel" 
          aria-labelledby="profile-tab" 
          tabindex="1">
      <div class="row">
        <div class="offset-lg-4 col-lg-8 col-xxl-6">
          <p class="text-muted small mt-2 mb-5">
            <%= t('admin.communication.contents.modes.structure.description') %>
          </p>
          <div id="mode-structure-container"></div>
        </div>
      </div>
    </div>
  </div>
</div>

<%= render 'admin/communication/blocks/offcanvas_editor' %>