Add customer searching capability
[cs356-p2-videostore.git] / app / views / customer / searchresults.rhtml
diff --git a/app/views/customer/searchresults.rhtml b/app/views/customer/searchresults.rhtml
new file mode 100644 (file)
index 0000000..a6488ce
--- /dev/null
@@ -0,0 +1,26 @@
+<h1>Search Results</h1>
+
+<% if @customers.empty? %>
+<p>Sorry, there were no results</p>
+<% else %>
+<table>
+  <tr>
+  <th>Customer ID</th>
+  <% for column in Customer.content_columns %>
+    <th><%= column.human_name %></th>
+  <% end %>
+  </tr>
+
+<% for customer in @customers %>
+  <tr>
+  <td><%=h customer.id %></td>
+  <% for column in Customer.content_columns %>
+    <td><%=h customer.send(column.name) %></td>
+  <% end %>
+    <td><%= link_to 'Show', :action => 'show', :id => customer %></td>
+    <td><%= link_to 'Edit', :action => 'edit', :id => customer %></td>
+    <td><%= link_to 'Destroy', { :action => 'destroy', :id => customer }, :confirm => 'Are you sure?', :post => true %></td>
+  </tr>
+<% end %>
+</table>
+<% end %>