From: Neil Smith Date: Wed, 11 Mar 2009 21:01:35 +0000 (+0000) Subject: Updated order and line item display X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=8c46f52399ab17d3434ec91b426ec2b29c8f20ef;p=depot.git Updated order and line item display --- diff --git a/app/views/layouts/line_items.html.erb b/app/views/layouts/line_items.html.erb deleted file mode 100644 index 78d24cc..0000000 --- a/app/views/layouts/line_items.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - LineItems: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= flash[:notice] %>

- -<%= yield %> - - - diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb index 39e117e..640e77e 100644 --- a/app/views/orders/index.html.erb +++ b/app/views/orders/index.html.erb @@ -6,6 +6,7 @@ Address Email Pay type + Total value <% for order in @orders %> @@ -14,10 +15,21 @@ <%=h order.address %> <%=h order.email %> <%=h order.pay_type %> + <%= number_to_currency (order.line_items.inject(0) {|sum,item| sum + item.total_price}), :unit => "£" %> <%= link_to 'Show', order %> <%= link_to 'Edit', edit_order_path(order) %> <%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %> + <% for li in order.line_items %> + + + <%= li.quantity%> × + <%= h li.product.title %> = + <%= number_to_currency li.total_price, :unit => "£" %> + + + <% end %> + <% end %>