noesya/osuny

View on GitHub
app/views/admin/communication/websites/pages/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, t('admin.communication.website.subnav.structure') %>

<div class="d-flex justify-content-between mb-4">
  <p>
    <%= @pages.size %>
    <%= Communication::Website::Page.model_name.human(count: @pages.size).downcase %>
  </p>
  <%= render 'filters', current_path: list_admin_communication_website_pages_path %>
</div>

<ul class="nav nav-tabs justify-content-md-end small">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page">
      <i class="fas fa-sitemap"></i>
      <%= t('admin.communication.website.pages.as_tree') %>
    </a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="<%= list_admin_communication_website_pages_path %>">
      <i class="fas fa-list"></i>
      <%= t('admin.communication.website.pages.as_list') %>
    </a>
  </li>
</ul>
<ul class="list-unstyled treeview mt-2">
  <li class="treeview__element treeview__element--opened treeview__element--loaded"
      data-id="<%= @homepage.id %>"
      data-parent="">
    <div class="<%= osuny_card_classes(horizontal: true) %> treeview__label">
      <%= osuny_thumbnail_localized @homepage %>
      <div class="card-body">
        <%= osuny_link_localized @homepage, admin_communication_website_page_path(@homepage) %>
      </div>
    </div>
    <ul class="list-unstyled treeview__children js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @homepage) %>"
        data-id="<%= @homepage.id %>"
        data-sort-url="<%= reorder_admin_communication_website_pages_path %>">
      <%= render 'treebranch', pages: @first_level_pages %>
    </ul>
  </li>
</ul>

<% content_for :action_bar_right do %>
  <%= create_link Communication::Website::Page %>
<% end %>