From e0b92cc2e0d255a101ffa5248d4d15080fe2ea63 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Thu, 12 Mar 2009 22:07:42 +0000 Subject: [PATCH] Updated order display again --- app/views/orders/index.html.erb | 49 +++++++++++++++---------------- app/views/products/index.html.erb | 2 +- public/stylesheets/depot.css | 22 +++++++------- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb index 308635e..bb43604 100644 --- a/app/views/orders/index.html.erb +++ b/app/views/orders/index.html.erb @@ -1,35 +1,32 @@ -
+

Listing orders

- - - - - - - - <% for order in @orders %> - - - - - - - - + + + - <% for li in order.line_items %> - - - - - <% end %> <% end %>
NameAddressEmailPay typeTotal value
<%=h order.name %><%=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 %> +
+
Order <%=h order.id %>
+
<%=h order.name %>
+
<%=h order.email %>
+
<%=h order.address %>
+
<%=h order.pay_type %>
+
+
+
+
Total value: <%= number_to_currency (order.line_items.inject(0) {|sum,item| sum + item.total_price}), :unit => "£" %>
+ <% for li in order.line_items %> +
<%= li.quantity%> × <%= h li.product.title %> = <%= number_to_currency li.total_price, :unit => "£" %>
+ <% end %> +
+
+ <%= link_to 'Show', order %>
+ <%= link_to 'Edit', edit_order_path(order) %>
+ <%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %>
+
<%= li.quantity%> × - <%= h li.product.title %> = - <%= number_to_currency li.total_price, :unit => "£" %> -
diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 1bed039..ca7fb6a 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,4 +1,4 @@ -
+

Listing products

diff --git a/public/stylesheets/depot.css b/public/stylesheets/depot.css index 5579185..01adb74 100644 --- a/public/stylesheets/depot.css +++ b/public/stylesheets/depot.css @@ -20,53 +20,53 @@ h1 { /* Styles for products/index */ -#product-list table { +#pretty-list table { border-collapse: collapse; } -#product-list table tr td { +#pretty-list table tr td { padding: 5px; vertical-align: top; } -#product-list .list-image { +#pretty-list .list-image { width: 60px; height: 70px; } -#product-list .list-description { +#pretty-list .list-description { width: 60%; } -#product-list .list-description dl { +#pretty-list dl { margin: 0; } -#product-list .list-description dt { +#pretty-list dt { color: #244; font-weight: bold; font-size: larger; } -#product-list .list-description dd { +#pretty-list dd { margin: 0; } -#product-list .list-description .unavailable { +#pretty-list .list-description .unavailable { color: #f00; } -#product-list .list-actions { +#pretty-list .list-actions { font-size: x-small; text-align: right; padding-left: 1em; } -#product-list .list-line-even { +#pretty-list .list-line-even { background: #e0f8f8; } -#product-list .list-line-odd { +#pretty-list .list-line-odd { background: #f8b0f8; } -- 2.34.1