Decoupled carts and orders
[depot.git] / app / views / store / index.html.erb
index c9f41e402827a1e0d2231017607b9aaad7526fca..7bbc2abaad5eab95d8f72a1d949edc92443cb10e 100644 (file)
@@ -2,12 +2,17 @@
 
 <% for product in @products -%>
   <div class="entry">
-    <%= link_to image_tag(product.image_url), {:action => "add_to_cart", :id => product}, :method => "post" %>
-    <h3><%= link_to h(product.title), {:action => "add_to_cart", :id => product}, :method => "post" %></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", :action => "add_to_cart", :id => product %>
+      <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 %>
+