fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<%= render "layouts/navbar" %> 

<div class="container text-center">
  <h1 class="text-uppercase text-center" id="title-list"><span class="glyphicon glyphicon-list text-left"></span> Lista de Alunos</h1>
  <hr>
     <%= form_tag(alumns_path, :method => "get", id: "search-form") do %>
      <div class="form-inline">
        <div class="input-group">
           <%= text_field_tag :search, params[:search], placeholder: "Digite nome ou matrícula do aluno", class: "form-control", :size=>"50"%>
           <span class="input-group-btn">
             <%= button_to 'Buscar'.html_safe, nil, class: "btn btn-default" %>
           </span>
        </div>
      </div>
   <% end %>
   <br>
</div>
<%= render "layouts/feedback_messages" %>
<section class="content-section" id="alumns-list">
  <div class="container">
  <% @alumns.each do |alumn| %>
    <div class="row item">
      <div class="col-sm-12 col-md-4">
        <% if alumn.image_file_name == nil %>
          <%= image_tag("avatar_250x300.png", alt: "", class: "img-responsive" ) %>
        <% else %>
          <%= image_tag(alumn.image.url(:original), alt: "", class: "img-responsive") %>
        <%end%>
      </div>
      <div class="col-sm-12 col-md-8 text-capitalize descript">
        <h2><%= alumn.name %></h2>
        <h4>Matrícula: <%= alumn.registry %></h4>
        <% if(!alumn.birth_date.nil?)%>
        <h4>Data de Nascimento:
          <%= alumn.birth_date.strftime("%d/%m/%Y") %>
        </h4>
        <%end%>
        <h4>Sexo: <%= alumn.gender %> </h4>
        <% if (!alumn.address.nil?) %>
          <h4>Endereço: <%= alumn.address %> </h4>
        <% end %>
        <h4>Tel.: <%= alumn.phone %> </h4>
        <%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, alumn_path(alumn), class:'btn btn-info' %>
        <%if is_principal? %>
        <%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_alumn_path(alumn), class:'btn btn-default' %>
        <%= link_to '<span class="fa fa-address-card"></span> Advertir'.html_safe, new_alumn_strike_path(alumn), class:'btn btn-warning' %>
        <%= link_to '<span class="fa fa-address-card"></span> Suspender'.html_safe, new_alumn_suspension_path(alumn), class:'btn btn-danger' %>
        <% end %>
      </div>
    </div>
    <hr>
  <% end %>
  </div>
</section>