Kercode/tutti_gruppi

View on GitHub
app/views/shared/_navigation.html.erb

Summary

Maintainability
Test Coverage
<nav class="d-flex navbar navbar-expand-lg navbar-light bg-dark">
  <div>
    <a class="navbar-brand-logo" href="/"><%= image_tag 'logo.png', id: 'logo' %></a>
  </div>
  <button class="navbar-toggler ml-auto custom-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <i class="fa fa-navicon"></i>
  </button>
  <div class="flex-row-reverse collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav text-center">
    <% if current_authentication %>
      
        <li class="nav-item <%= 'active' if current_page?('/orders/new') %>">
          <a href="/orders/new" class="order nav-link">Commander</a>
        </li>
      
      <li class="nav-item <%= 'active' if current_page?('/orders') %>">
        <a href="/orders" class="order nav-link">Liste des commandes</a>
      </li>
      <li class="nav-item <%= 'active' if current_page?('/authentications/show') %>">
        <a href="/authentications/show" class="order nav-link">Profil</a>
      </li>
      <% if current_authentication.admin? %>
        <li class="nav-item <%= 'active' if current_page?('/admin/dashboard') %>">
          <%= link_to 'Dashboard', '/admin/dashboard', class: 'order nav-link' %>
        </li>
      <% end %>
      <% if authentication_signed_in? %>
        <li class="nav-item <%= 'active' if current_page?('/groupment/show') %>">
          <%= link_to 'Groupment', '/groupment/show', class: 'order nav-link' %>
        </li>
        <li class="nav-item <%= 'active' if current_page?(destroy_authentication_session_path) %>">
          <%= link_to 'Déconnexion', destroy_authentication_session_path, method: :delete, class: 'order nav-link' %>
        </li>
      <% end %>
      <% else %>
        <li class="nav-item <%= 'active' if current_page?(new_authentication_session_path) %>">
          <%= link_to 'Connexion', new_authentication_session_path, class: 'order nav-link' %>
        </li>
    <% end %>
    </ul>
  </div>
</nav>