vegantech/sims

View on GitHub
app/views/district/students/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Student Listing</h1>

<%= form_tag district_students_path, :method=>:get do %>
  <%=label_tag :last_name, "Last Name, Any part"%>
  <%=text_field_tag :last_name, params[:last_name] %>
  <%=submit_tag "Search by Last Name", :name=>nil %>
<% end %>

<%= will_paginate @students %>

<table>
  <tr>
    <th>First Name</th>
    <th>Middle Name</th>
    <th>Last Name</th>
    <th>Suffix</th>
    <th>Number</th>
    <th>Id District</th>
    <th>Birthdate</th>
  </tr>

<% for student in @students %>
  <tr>
    <td><%=h student.first_name %></td>
    <td><%=h student.middle_name %></td>
    <td><%=h student.last_name %></td>
    <td><%=h student.suffix %></td>
    <td><%=h student.number %></td>
    <td><%=h student.district_student_id %></td>
    <td><%=h student.birthdate %></td>
    <td><%= link_to 'Edit', edit_district_student_path(student) %></td>
    <td><%= link_to 'Remove from district', district_student_path(student), :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Student', new_district_student_path %>