fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<%= render "layouts/navbar" %>
<% if flash[:notice]%>
    <br>
    <br>
    <div class="alert alert-info" role = "alert"><%= flash[:notice]%></div>
  <%end%>
  <% if flash[:alert]%>
    <br>
    <br>
    <div class="alert alert-danger" role = "alert"><%= flash[:alert]%></div>
  <% end %>

<div class="container text-center">
  <h1 class="text-uppercase text-center" id="title-list"><span class="glyphicon glyphicon-list text-left"></span> Lista de Secretários</h1>
  <hr>
     <%= form_tag(secretaries_path, :method => "get", id: "search-form") do %>
      <div class="form-inline">
      <div class="input-group">
                <%= text_field_tag :search, params[:search], placeholder: "Digite o nome do secretário(a)", 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">
  <% @secretaries.each do |secretary| %>
  <div class="container">
    <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><%= secretary.name %></h2>
        <h4> <%= secretary.address %> </h4>
        <h4>Data de Nascimento:  
          <% if(!secretary.birth_date.nil?)%>
              <%= secretary.birth_date.strftime("%d/%m/%Y") %>
          <%end%>
        </h4>
        <h4> <%= secretary.gender %> </h4>
        <h4> <%= secretary.phone %> </h4>
        <h4><%= secretary.employee_cpf %></h4>
        <%= link_to '<span class="fa fa-search-plus"></span> Visualizar'.html_safe, secretary_path(secretary), class:'btn btn-info' %>
        <%if is_principal? %>
          <%= link_to '<span class="fa fa-unlock"></span> Resetar senha'.html_safe, edit_password_employee_path(secretary), class:'btn btn-default' %>
        <% end %>
      </div>
    </div>
    <hr>
  </div>
  <% end %>
</section>