Add coitem MVC
[cs356-p2-videostore.git] / app / views / coitem / list.rhtml
diff --git a/app/views/coitem/list.rhtml b/app/views/coitem/list.rhtml
new file mode 100644 (file)
index 0000000..44b9c2d
--- /dev/null
@@ -0,0 +1,31 @@
+<h1>Listing coitems</h1>
+
+<table>
+  <tr>
+  <th>Customer</th>
+  <th>Rentable</th>
+  <% for column in Coitem.content_columns %>
+    <th><%= column.human_name %></th>
+  <% end %>
+  </tr>
+  
+<% for coitem in @coitems %>
+  <tr>
+  <td><%=h Customer.find(coitem.customer_id).name %></td>
+  <td><%=h Rentable.find(coitem.rentable_id).title %></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>
+  </tr>
+<% end %>
+</table>
+
+<%= 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' %>