fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#coll-nav" aria-expanded="false">
        <span class="fa fa-angle-down"></span>
      </button>
      <% if is_alumn? %>
        <%= link_to image_tag("Logo_Escola_X_50x50.png", :alt => "logo"), alumn_path(@current_user) %>
      <% elsif is_parent? %>
        <%= link_to image_tag("Logo_Escola_X_50x50.png", :alt => "logo"), alumns_path %>
      <% elsif is_teacher? %>
        <%= link_to image_tag("Logo_Escola_X_50x50.png", :alt => "logo"), teacher_path(@current_user) %>
      <% else %>
        <%= link_to image_tag("Logo_Escola_X_50x50.png", :alt => "logo"), users_path %>
      <% end %>
    </div>
    <div class="collapse navbar-collapse" id="coll-nav">
      <div class="custom-white-txt nav nav-bar">
        <% if is_alumn? %>
          Logado como: Aluno
        <% elsif is_parent? %>
          Logado como: Responsável
        <% elsif is_teacher? %>
          Logado como: Professor
        <% elsif is_principal? %>
          Logado como: Diretor
        <% else %>
          Logado como: Secretário
        <% end %>
      </div>
      <ul class="nav navbar-nav">
          <% if is_teacher? %>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-hospopup="true" aria-expanded="false">
                <span class="fa fa-plus"></span> Criar
              </a>
              <ul class="dropdown-menu">
                <li><%= link_to '<span class="fa fa-paper-plane-o"></span> Criar Notificação'.html_safe, new_notification_path %></li>
              </ul>
            </li>
          <%end%>
          <% if is_principal? %>
            <li><%=link_to '<span class="fa fa-address-card-o"></span> Catraca'.html_safe, reader_index_path %></li>
            <li class="dropdown">
              <a href="errors/error_500" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-hospopup="true" aria-expanded="false">
                <span class="fa fa-plus"></span> Criar
              </a>
              <ul class="dropdown-menu">
                <li><%=link_to '<span class="fa fa-book"></span> Criar Matéria'.html_safe, subjects_path %></li>
                <%if is_principal? %>
                  <li><%= link_to '<span class="fa fa-user-plus"></span> Criar Responsável e Aluno'.html_safe, new_parent_path %></li>
                  <li><%= link_to '<span class="fa fa-user-circle-o"></span> Criar Secretário'.html_safe, new_secretary_path %></li>
                  <li><%= link_to '<span class="fa fa-user-plus"></span> Criar Professor'.html_safe, new_teacher_path %></li>
                  <li><%= link_to '<span class="fa fa-users"></span> Criar Turma'.html_safe, new_classroom_path %></li>
                  <li><%= link_to '<span class="fa fa-paper-plane-o"></span> Criar Notificação'.html_safe, new_notification_path %></li>
                <% end %>
              </ul>
            </li>
          <% end %>
        <%if is_principal? or is_secretary? or is_teacher?%>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-hospopup="true" aria-expanded="false">
              <span class="fa fa-search"></span> Visualizar
            </a>
            <ul class="dropdown-menu">
              <% if is_principal? %>
                <li><%= link_to '<span class="fa fa-user-circle-o"></span> Secretários'.html_safe, secretaries_path %></li>
                <li><%=link_to '<span class="fa fa-book"></span> Matéria'.html_safe, subjects_path %></li>
              <% end %>
              <% if is_principal? or is_secretary?%>
                <li><%= link_to '<span class="fa fa-users"></span> Turmas'.html_safe, classrooms_path %></li>
              <%end%>
              <li><%= link_to '<span class="fa fa-user"></span> Alunos'.html_safe, alumns_path %></li>
              <li><%= link_to '<span class="fa fa-user-circle"></span> Responsáveis'.html_safe, parents_path %></li>
              <li><%= link_to '<span class="fa fa-graduation-cap"></span> Professores'.html_safe, teachers_path %></li>
              <li><%= link_to '<span class="fa fa-user-circle-o"></span> Funcionários'.html_safe, employees_path %></li>
            </ul>
          </li>
        <% end %>
        <li><%=link_to '<span class="fa fa-sticky-note-o"></span> Avisos'.html_safe, notifications_path %></li>
        <li><%=link_to '<span class="fa fa-sign-out"></span> Sair'.html_safe, logout_path, name:"logout" %></li>
      </ul>
    </div>
  </div>
</nav>