fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/views/employees/index.html.erb

Summary

Maintainability
Test Coverage

<%= render "layouts/navbar" %>
<% if flash[:alert]%>
  <br>
  <br>
 <div class="alert alert-danger" role = "alert"><%= flash[:alert]%></div>
<% end %>
<% if flash[:success]%>
 <div class="alert alert-success" role = "alert"><%= flash[:success]%></div>
<% end %>
<h1 class="text-uppercase text-center" id="title-list"><span class="glyphicon glyphicon-list text-left"></span> Lista de Funcionários</h1>
<hr>
<section class="content-section" id="alumns-list">
  <div class="container">
    <% @employees.each do |employee| %>
      <div class="row item">
        <div class="col-sm-12 col-md-4">
          <%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %>
        </div>
        <div class="col-sm-12 col-md-8 text-capitalize descript">
          <h2><%= employee.name %></h2>
          <h4> <%= employee.address %> </h4>
          <h4>Data de Nascimento:
            <% if(!employee.birth_date.nil?)%>
                <%= employee.birth_date.strftime("%d/%m/%Y") %>
            <%end%>
          </h4>
          <h4> <%= employee.gender %> </h4>
          <h4> <%= employee.phone %> </h4>
          <h4><%= employee.registry %></h4>
          <% if (employee.is_a?(Teacher)) %>
            <h5 class="text-warning">Professor</h5>
            <%= link_to '<span class="fa fa-search"></span> Visualizar'.html_safe, teacher_path(employee), class:'btn btn-info' %>
          <% end %>
          <% if (employee.is_a?(Principal)) %>
            <h5 class="text-warning">Diretor</h5>
            <%= link_to '<span class="fa fa-search"></span> Visualizar'.html_safe, principal_path(employee), class:'btn btn-info' %>
          <% end %>
          <% if (employee.is_a?(Secretary)) %>
            <h5 class="text-warning">Secretário</h5>
            <%= link_to '<span class="fa fa-search"></span> Visualizar'.html_safe, secretary_path(employee), class:'btn btn-info' %>
          <% end %>
          <%if is_principal? %>
            <%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_employee_path(employee), class:'btn btn-default' %>
          <% end %>
        </div>
        <hr>
      </div>
    <% end %>
  </div>
</section>