fga-gpp-mds/2017.1-Escola-X

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

Summary

Maintainability
Test Coverage
<%= form_for @alumn, :html => { :multipart => true }  do |f| %>
  <% if @alumn.errors.any? %>
    <div class="container">
      <div class="text-danger text-justify">
        <div id="error_explanation">
          <h2 class=""><%= pluralize(@alumn.errors.count, "erro") %> proibiram este formulario de ser salvo:</h2>
          <ul>
          <% @alumn.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
          </ul>
        </div>
      </div>
    </div>
  <% end %>
  <div class="form-group">
    <%= f.label :name, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-user"></span>
         Nome
      </span>
      <%= f.text_field :name, class:"form-control", placeholder:"Nome do usuário" %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :registry, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-id-card"></span>
        Matricula
      </span>
      <%= f.number_field :registry, class:"form-control", placeholder:"Ex.: 153456" %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :shift, class:"sr-only" %>
    <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>
  <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-users"></span>
        Turma
      </span>
      <%= f.select :classroom_id, @classrooms.collect {|classroom| [classroom.classroom_grade.name_classroom_grade + " " + classroom.name_classroom, classroom.id]},{:include_blank => false}, {:class => "form-control", :id => "sel1"}%>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :address, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-home"></span>
         Endereço
      </span>
      <%= f.text_field :address, class:"form-control", placeholder:"Ex.: Rua do limoeiro, casa 53" %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :phone, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-phone"></span>
         Telefone
      </span>
      <%= f.text_field :phone, class:"form-control", placeholder:'Somente números com DDD.' %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :birth_date, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-gift"></span>
         NASC.
      </span>
      <%= f.date_field :birth_date, class:"form-control", placeholder:"Ex.: dd/mm/aaaa" %>
    </div>
  </div>
  <div class="form-group">
    <div class="input-group">
      <span class="input-group-addon">
        <span class="fa fa-venus-mars"></span>
         Sexo
      </span>
      <div class="btn-group" data-toggle="buttons">
        <label class="btn btn-radio" name="btn1">
          <%= f.radio_button(:gender,"Feminino") %> Feminino
        </label>
        <label class="btn btn-radio" name="btn2">
          <%= f.radio_button(:gender,"Masculino") %> Masculino
        </label>
      </div>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :bar_code, class:"sr-only" %>
    <div class="input-group">
      <span class="input-group-addon">
        <span class="    fa fa-address-card-o"></span>
        Codigo de barras
      </span>
      <%= f.text_field :bar_code, class:"form-control", placeholder:"Passe a carteirinha pelo leitor" %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :phone, class:"sr-only" %>
    <div class="field">
      <div class="form-group">
        <div class="field">
          <input type="file" name="alumn[image]" id="alumn_image" class="filestyle" data-buttonBefore="true">
        </div>
      </div>
    </div>
  </div>
  <%= f.button '<span class="fa fa-check"></span> Salvar'.html_safe, type:"submit", class:'btn btn-lg btn-success' %>
<% end %>