End chapter 10
[depot.git] / app / views / store / index.html.erb
index 1ed17dd5e287aec1af5b7c85ad68c70656c0f43a..63c12da3a258b96303b2a1a59169baabab38cea0 100644 (file)
@@ -1,13 +1,19 @@
+<div id="main_panel">
 <h1>Neil's Whimsical Store Catalogue</h1>
 
 <% for product in @products -%>
   <div class="entry">
-    <%= image_tag(product.image_url) %>
-    <h3><%=h product.title %></h3>
+    <% form_remote_tag :url => {:action => 'add_to_cart', :id => product} do %>
+      <%= image_submit_tag(product.image_url) %>
+    <% end %>
+    <h3><%= h(product.title) %></h3>
     <%= product.description %>
     <div class="price-line">
-      <span class="price"><%= number_to_currency product.price, :unit => "&pound;" %></span>
-      <%= button_to "Add to cart" %>
+      <span class="price"><%= number_to_currency product.price, :unit => "£" %></span>
+      <% form_remote_tag :url => {:action => 'add_to_cart', :id => product} do %>
+        <%= submit_tag "Add to cart" %>
+      <% end %>
     </div>
   </div>
 <% end %>
+</div>