coopdevs/timeoverflow

View on GitHub
app/views/application/_navbar.html.erb

Summary

Maintainability
Test Coverage
<nav class="navbar navbar-static-top navbar-inverse" role="navigation">
  <div class="container-fluid">
    <div class="container">
      <div class="row">
        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>

            <% if current_user && current_organization %>
              <a class="navbar-brand" href="<%= organization_path(current_organization) %>">TimeOverflow</a>
            <% else %>
              <a class="navbar-brand" href="/">TimeOverflow</a>
            <% end %>
          </div>
        </div>
        <div class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
          <div id="navbar-collapse" class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right hidden-xs">
              <% if current_user %>
                <%= render 'application/menus/user_admin_menu' %>
              <% else %>
                <%= render 'application/menus/visitor_menu' %>
              <% end %>
            </ul>

            <ul class="nav navbar-nav navbar-right hidden-sm hidden-md hidden-lg">
              <% if current_user %>
                <li>
                  <%= image_tag avatar_url(current_user) %>
                  <%= current_user.email %>
                </li>
                <%= render 'application/menus/user_admin_menu_items' %>
              <% else %>
                <%= render 'application/menus/visitor_menu' %>
              <% end %>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</nav>

<% if current_user && current_organization %>
  <nav role="navigation">
    <div class="container">
      <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
          <ul class="nav nav-pills actions-menu">
            <li class="<%= "active" if current_page?(users_path) %>">
              <%= link_to users_path do %>
                <%= glyph :user %>
                <%= t("users.index.members") %>
              <% end %>
            </li>
            <li class="<%= "active" if current_page?(offers_path) %>">
              <%= link_to offers_path do %>
                <%= glyph :offer %>
                <%= Offer.model_name.human(count: :many) %>
              <% end %>
            </li>
            <li class="<%= "active" if current_page?(inquiries_path) %>">
              <%= link_to inquiries_path do %>
                <%= glyph :inquiry %>
                <%= Inquiry.model_name.human(count: :many) %>
              <% end %>
            </li>
            <li class="<%= "active" if current_page?(alpha_grouped_index_tags_path) %>">
              <%= link_to alpha_grouped_index_tags_path do %>
                <%= glyph :tags %>
                <%= t ".tags" %>
              <% end %>
            </li>
            <% if current_user.manages? current_organization %>
              <%= render 'application/menus/organization_reports_menu' %>
              <%= render 'application/menus/organization_statistics_menu' %>
              <%= render 'application/menus/organization_listings_menu' %>
            <% end %>
          </ul>
        </div>
      </div>
    </div>
  </nav>
<% end %>