fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<%= render "layouts/navbar" %>
<br>
<br>
<% if flash[:notice]%>
 <div class="alert alert-warning" role = "alert"><%= flash[:notice]%></div>
<% end %>
<h1 class="text-uppercase text-center" id="title-list"><span class="glyphicon glyphicon-list text-left"></span> Lista de Turmas</h1>
<hr>

<div class="container text-center">
  <%= form_tag(classrooms_path, :method => "get", id: "search-form") do %>
    <div class="form-inline">
      <div class="input-group">
        <span class="input-group-addon">
          <span class="fa fa-television"></span>
          Série
        </span>
        <%= select_tag :classroom_grade_id, options_for_select(ClassroomGrade.all.collect {|classroom_grade| [classroom_grade.name_classroom_grade, classroom_grade.id]}), {:class => "form-control", :id => "sel1", :include_blank => true}%>
        <span class="input-group-addon">
          <span class="fa fa-clock-o"></span>
          Turno
        </span>
        <%= select_tag :shift_id, options_for_select(Shift.all.collect {|shift| [shift.name_shift, shift.id]}), {:class => "form-control", :id => "sel1", :include_blank => true}%>
        <span class="input-group-btn">
          <%= button_to 'Buscar'.html_safe, nil, class: "btn btn-default" %>
        </span>
      </div>
    </div>
  <% end %>
</div>

<section class="content-section" id="alumns-desc">
  <% @classrooms.each do |classroom| %>
    <div class="container">
      <div class="row">
        <div class="col-sm-12 col-md-7 pull-right">
          <%if is_principal? or is_secretary? %>
          <%= link_to '<span class="fa fa-address-card"></span> Gerar XLS'.html_safe, classroom_path(classroom.id,format: "xls"),class: 'btn btn-sm btn-success' %>
          <% end %>
          <%if is_employee? %>
            <%if is_principal? %>
              <%= link_to '<span class="fa fa-edit"></span> Editar'.html_safe, edit_classroom_path(classroom), class:"btn btn-sm btn-default" %>
              <%= link_to '<span class="fa fa-search"></span> Visualizar'.html_safe, classroom_path(classroom), class:'btn btn-sm btn-info'%>
              <%= link_to '<span class="fa fa-user-plus"></span> Adicionar Alunos'.html_safe, add_alumns_path(classroom), class:"btn btn-sm btn-warning" %>
            <% end %>
            <%= link_to '<span class="fa fa-address-card"></span> Matérias'.html_safe, classroom_subjects_path(classroom), class:'btn btn-sm btn-primary' %>
          <% end %>
        </div>
        <div class="col-sm-12 col-md-5">
          <p class="class-name">Nome da Turma: <%= classroom.name_classroom %></p>
          <h3 class="">Série: <%= ClassroomGrade.find_by_id(classroom.classroom_grade_id).name_classroom_grade %></h3>
          <h3 class="">Turno: <%= Shift.find_by_id(classroom.shift_id).name_shift %></h3>
        </div>
      </div>
    </div>
    <hr>
  <% end %>
</section>