Add Purchase system
[cs356-p2-videostore.git] / app / views / purchase / list.rhtml
diff --git a/app/views/purchase/list.rhtml b/app/views/purchase/list.rhtml
new file mode 100644 (file)
index 0000000..593b7a6
--- /dev/null
@@ -0,0 +1,27 @@
+<h1>Listing purchases</h1>
+
+<table>
+  <tr>
+  <% for column in Purchase.content_columns %>
+    <th><%= column.human_name %></th>
+  <% end %>
+  </tr>
+  
+<% for purchase in @purchases %>
+  <tr>
+  <% for column in Purchase.content_columns %>
+    <td><%=h purchase.send(column.name) %></td>
+  <% end %>
+    <td><%= link_to 'Show', :action => 'show', :id => purchase %></td>
+    <td><%= link_to 'Edit', :action => 'edit', :id => purchase %></td>
+    <td><%= link_to 'Destroy', { :action => 'destroy', :id => purchase }, :confirm => 'Are you sure?', :method => :post %></td>
+  </tr>
+<% end %>
+</table>
+
+<%= link_to 'Previous page', { :page => @purchase_pages.current.previous } if @purchase_pages.current.previous %>
+<%= link_to 'Next page', { :page => @purchase_pages.current.next } if @purchase_pages.current.next %> 
+
+<br />
+
+<%= link_to 'New purchase', :action => 'new' %>