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