End chapter 8
[depot.git] / app / views / store / add_to_cart.html.erb
diff --git a/app/views/store/add_to_cart.html.erb b/app/views/store/add_to_cart.html.erb
new file mode 100644 (file)
index 0000000..64270c3
--- /dev/null
@@ -0,0 +1,18 @@
+<h2>Your Whimsical Cart</h2>
+
+<div class="cart-title">Your Cart</div>
+    <table>
+    <% for item in @cart.items %>
+        <tr>
+            <td><%= item.quantity %>&times;</td>
+            <td><%=h item.title %></td>
+            <td class="item-price"><%= number_to_currency(item.price, :unit => "£") %></td>
+        </tr>
+    <% end %>
+        <tr class="total-line">
+            <td colspan="2">Total</td>
+            <td class="total-cell"><%= number_to_currency(@cart.total_price, :unit => "£") %></td>
+        </tr>
+    </table>
+
+<%= button_to 'Empty cart', :action => :empty_cart %>