From 8c46f52399ab17d3434ec91b426ec2b29c8f20ef Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Wed, 11 Mar 2009 21:01:35 +0000 Subject: [PATCH] Updated order and line item display --- app/views/layouts/line_items.html.erb | 17 ----------------- app/views/orders/index.html.erb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 17 deletions(-) delete mode 100644 app/views/layouts/line_items.html.erb 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 %> -- 2.34.1