Small Cleanups + Merchandise Search
[cs356-p2-videostore.git] / app / views / coitem / list.rhtml
index f6514cb..ac10575 100644 (file)
@@ -1,26 +1,29 @@
-<h1>Listing coitems</h1>
+<h1>Listing Checked Out Items</h1>
 
-<table>
+<table border="1">
   <tr>
-  <th>Customer</th>
-  <th>Rentable</th>
-  <th>Overdue</th>
-  <% for column in Coitem.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
+    <th>Item ID</th>
+    <th>Customer</th>
+    <th>Type</th>
+    <th>Rentable</th>
+    <th>Overdue</th>
+    <th>Date Checked Out</th>
+    <th>Due Date</th>
   </tr>
   
 <% for coitem in @coitems %>
   <tr>
-  <td><%=h coitem.customer.name %></td>
-  <td><%=h coitem.rentable.title %></td>
-  <td><%=h coitem.overdue? %></td>
-  <% for column in Coitem.content_columns %>
-    <td><%=h coitem.send(column.name) %></td>
-  <% end %>
-    <td><%= link_to 'Show', :action => 'show', :id => coitem %></td>
-    <td><%= link_to 'Edit', :action => 'edit', :id => coitem %></td>
-    <td><%= link_to 'Destroy', { :action => 'destroy', :id => coitem }, :confirm => 'Are you sure?', :method => :post %></td>
+    <td><%=h coitem.rentable.id.to_s %></td>
+    <td><%=h coitem.customer.name %></td>
+    <td><%=h coitem.rentable.class %></td>
+    <% if coitem.rentable.type == Game %>
+    <td><%=link_to coitem.rentable.title.to_s, :controller => 'game', :action => 'show', :id => coitem.rentable %></td>
+    <% else %>
+    <td><%=link_to coitem.rentable.title.to_s, :controller => 'video', :action => 'show', :id => coitem.rentable %></td>
+    <% end %>
+    <td><%=h tf_to_yesno(coitem.overdue?) %></td>
+    <td><%=h coitem.out_date %></td>
+    <td><%=link_to coitem.due_date.to_s, :action => 'edit', :id => coitem %></td>
   </tr>
 <% end %>
 </table>
@@ -28,6 +31,3 @@
 <%= link_to 'Previous page', { :page => @coitem_pages.current.previous } if @coitem_pages.current.previous %>
 <%= link_to 'Next page', { :page => @coitem_pages.current.next } if @coitem_pages.current.next %> 
 
-<br />
-
-<%= link_to 'New coitem', :action => 'new' %>