fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<%= form_for (@classroom) do |f| %>
  <% if @classroom.errors.any? %>
    <div class="container">
      <div class="text-danger">
        <div id="error_explanation">
          <h2 class=""><%= pluralize(@classroom.errors.count, "erro proibiu", "erros proibiram") %> este formulario de ser salvo:</h2>
          <ul>
          <% @classroom.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
          </ul>
        </div>
      </div>
    </div>
  <% end %>

  <div class="form-group">
    <%= f.label :name_classroom, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-sticky-note"></span>
          Nome da turma
      </span>
      <%= f.text_field :name_classroom, class:"form-control", placeholder:"Exemplo: D ou A" %>
    </div>
  </div>

  <div class="form-group">
    <%= f.label :classroom_id, class:"sr-only", id: "sel1" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-television"></span>
        Série
      </span>
      <%= f.select :classroom_grade_id, @classroom_grades.collect {|classroom_grade| [classroom_grade.name_classroom_grade, classroom_grade.id]}, {:include_blank => false}, {:class => "form-control", :id => "sel1"}%>
    </div>
  </div>

  <div class="form-group">
    <%= f.label :classroom_id, class:"sr-only", id: "sel1" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-clock-o"></span>
        Turno
      </span>
      <%= f.select :shift_id, @shifts.collect {|shift| [shift.name_shift, shift.id]}, {:include_blank => false}, {:class => "form-control", :id => "sel1"}%>
    </div>
  </div>

  <%= f.button '<span class="fa fa-check"></span> Salvar'.html_safe, type:"submit", class:'btn btn-lg btn-success' %>
<% end %>