Updated order display
[depot.git] / app / views / store / _cart.html.erb
index 01fbeb5ed357b0a356582f840c7e5aaae04ff3e0..313d23e5cd072d276050de69dd43db8aa69ba85b 100644 (file)
@@ -1,11 +1,21 @@
 <div class="cart-title">Your Cart</div>
-    <table>
-    <%= render(:partial => 'cart_item', :collection => cart.items) %>
+<table>
+  <%= render(:partial => 'cart_item', :collection => cart.items.sort_by {|item| item.product.title}) %>
 
-        <tr class="total-line">
-            <td colspan="2">Total</td>
-            <td class="total-cell"><%= number_to_currency(cart.total_price, :unit => "£") %></td>
-        </tr>
-    </table>
+  <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 %>
+<% unless @during_checkout %>
+  <div id="checkout_buttons">
+    <% form_remote_tag :url => {:action => 'checkout'} do %>
+      <%= submit_tag "Checkout" %>
+    <% end %>
+
+    <% form_remote_tag :url => {:action => 'empty_cart'} do %>
+      <%= submit_tag "Empty cart" %>
+    <% end %>
+  </div>
+<% end %>