fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/views/school_misses/_index.html.erb

Summary

Maintainability
Test Coverage
<% if (@current_user.is_a?(Employee)) %>
  <%= link_to '<span class="fa fa-user-times"></span> Adicionar uma nova falta'.html_safe, new_alumn_school_miss_path(@alumn), class:"btn btn-success btn-sm" %>
<% end %>
  <ul>
    <br>
    <% @alumn.school_misses.all.reverse.each do |miss| %>
      <% if (@current_user.is_a?(Principal)) %>
        <!-- <br> -->
        <li class="text-danger inline">
          <%= miss.date.day %>/<%= miss.date.month %>/<%= miss.date.year %>
        </li>
        <%= link_to '<span class="fa fa-edit"></span> Editar'.html_safe, edit_alumn_school_miss_path(@alumn, miss), class:"btn btn-xs btn-shades" %>
        <%= link_to '<span class="fa fa-times"></span> Deletar'.html_safe, [@alumn, miss], :method  => :delete, class:"btn btn-xs btn-default" %>
      <% else %>
        <br>
        <li class="text-danger"><%= miss.date.day %>/<%= miss.date.month %>/<%= miss.date.year %></li>
      <% end %>
    <% end %>
  </ul>