Skip to content

Commit

Permalink
Proper caching for products and orders. Render in 10ms or less.
Browse files Browse the repository at this point in the history
Begin CSS on product index and order show.
  • Loading branch information
Mary Cutrali committed May 2, 2012
1 parent aa0aacc commit 8e1cf88
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 37 deletions.
13 changes: 6 additions & 7 deletions app/assets/stylesheets/products.css.scss
Expand Up @@ -3,26 +3,25 @@
// You can use Sass (SCSS) here: http://sass-lang.com/

.products-listing{
width: 90%;
width: 100%;
padding-left: 10%;
}

.indiv-product{
display: inline-block;
padding: 25px;
width: 15%
}

.product-details{
display: block;
position: absolute;
width: 100%;
top: -100px
font-size: 16px;
top: -100px;
}

.product-thumbnail{
height: 100%;
width: 100%;
height: 85%;
width: 85%;
}

#prod-index-title{
Expand All @@ -34,5 +33,5 @@
}

#prod-index-cart{
float: right;

}
38 changes: 18 additions & 20 deletions app/views/orders/show.html.slim
@@ -1,21 +1,19 @@
- cache(@order) do
h2#order_number = "Order ##{@order.id}"
h3 = "Status: #{@order.status}"
h3 = "Total: #{@order.total}"
h4
= "To visit this order again in the future use your "
= link_to "order permalink", permalink(@order), :id => 'unique_url'
h2#order_number = "Order ##{@order.id}"
h3 = "Status: #{@order.status}"
h3 = "Total: #{@order.total}"
h4
= "To visit this order again in the future use your "
= link_to "order permalink", permalink(@order), :id => 'unique_url'

table.table.table-striped.table-condensed
tr
th Name
th Price
th Quantity
th Subtotal
- @order.items.each do |item|
- cache(item) do
tr
td = link_to(item.title, product_path(@store, item.product))
td = link_to(item.price, product_path(@store, item.product))
td = link_to(item.quantity, product_path(@store, item.product))
td = link_to(item.subtotal, product_path(@store, item.product))
table.table.table-striped.table-condensed
tr
th Name
th Price
th Quantity
th Subtotal
- @order.items.each do |item|
tr
td = link_to(item.title, product_path(@store, item.product))
td = link_to(item.price, product_path(@store, item.product))
td = link_to(item.quantity, product_path(@store, item.product))
td = link_to(item.subtotal, product_path(@store, item.product))
20 changes: 10 additions & 10 deletions app/views/products/index.html.slim
@@ -1,14 +1,14 @@
h1 Products
.products-listing
- @products.each do |product|
.indiv-product
.product-thumbnail
img src="#{product.photo}"
.product-details
#prod-index-title
= link_to product.title, product_path(@store, product)
#prod-index-price
= number_to_currency(product.price)
#prod-index-cart
= link_to "Add to Cart", cart_path(:product_id => product), :method => :put, :class=>'btn btn-mini'
.indiv-product
.product-thumbnail
img src="#{product.photo}"
.product-details
#prod-index-title
= link_to product.title, product_path(@store, product)
#prod-index-price
= number_to_currency(product.price)
#prod-index-cart
= link_to "Add to Cart", cart_path(:product_id => product), :method => :put, :class=>'btn btn-mini'
= will_paginate @productsg

0 comments on commit 8e1cf88

Please sign in to comment.