programandoarg/pg_rails

View on GitHub
pg_layout/app/views/pg_layout/_sidebar.html.erb

Summary

Maintainability
Test Coverage
<div id="sidebar" class="<%= @navbar_opened_class %> flex-shrink-0 d-none d-<%= @breakpoint_navbar_expand %>-block">
  <div class="mt-1">
    <div class="m-3">
      <%= @navbar.logo if @navbar.logo.present? %>
    </div>
    <% if user_signed_in? %>
      <span class="ms-3 text-light"><%= Current.user %></span>
      <hr>
    <% end %>
    <ul class="list-unstyled ps-0">
      <% @navbar.sidebar.each do |entry| %>
        <% next if @navbar.hide_entry?(entry) %>

        <li class="mb-1">
          <a
            href="<%= entry[:path] %>"
            class="
              d-inline-flex text-decoration-none ms-3
              <%= @navbar.active_entry?(entry, request) ? 'active' : '' %>"
            <%= entry[:attributes] %>
          >
            <%= entry[:title] %>
          </a>
        </li>
      <% end %>
    </ul>
  </div>
</div>