Created
October 29, 2015 19:31
-
-
Save aviflombaum/41bbb6c767987788519b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>Class Roster</h3> | |
<table> | |
<tr> | |
<th>First</th> | |
<th>Last</th> | |
<th>Gender</th> | |
<th colspan="2"></th> | |
</tr> | |
<% @students.each_with_index do |student, i| %> | |
<tr> | |
<%= form_for [@group, student] do |f| %> | |
<% if student.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(student.errors.count, "error") %> | |
prohibited this student from being saved:</h2> | |
<ul> | |
<% student.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> | |
<td><%= f.text_field :first_name %></td> | |
<td><%= f.text_field :last_name %></td> | |
<td><select name="<%= i %>" id="<%= i %>"><option value="male" <%= student.gender == 'male' ? "selected='selected'" : "" %>>Male</option><option value="female" <%= student.gender == 'female' ? "selected='selected'" : "" %>>Female</option></select></td> | |
<td><%= f.submit "Save change" %><td> | |
<% end %> | |
<td><%= button_to "Remove student", group_student_path(@group, student), method: :delete %></td> | |
</tr> | |
<% end %> | |
</table> | |
<%= link_to "Add another student", new_group_student_path(@group) %><br> | |
<%= link_to "Back", group_path(@group) %> | |
<!-- class settings link that leads to setting up separations --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment