Finished Chapter 12
[depot.git] / app / views / info / who_bought.atom.builder
1 atom_feed do |feed|
2 feed.title "Who bought #{@product.title}"
3 feed.updated @orders.first.created_at
4 for order in @orders
5 feed.entry(order) do |entry|
6 entry.title "Order #{order.id}"
7 entry.summary :type => 'xhtml' do |xhtml|
8 xhtml.p "Shipped to #{order.address}"
9 xhtml.table do
10 xhtml.tr do
11 xhtml.th 'Product'
12 xhtml.th 'Quantity'
13 xhtml.th 'Total Price'
14 end
15 for item in order.line_items
16 xhtml.tr do
17 xhtml.td item.product.title
18 xhtml.td item.quantity
19 xhtml.td number_to_currency item.total_price
20 end
21 end
22 xhtml.tr do
23 xhtml.th 'total' , :colspan => 2
24 xhtml.th number_to_currency \
25 order.line_items.map(&:total_price).sum
26 end
27 end
28 xhtml.p "Paid by #{order.pay_type}"
29 end
30 entry.author do |author|
31 entry.name order.name
32 entry.email order.email
33 end
34 end
35 end
36 end