Skip to content

Commit

Permalink
Fixed layout for the categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Austen Ito committed Apr 19, 2012
1 parent 7148043 commit 090d220
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
7 changes: 6 additions & 1 deletion app/controllers/categories_products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ class CategoriesProductsController < ApplicationController

def index
@category = Category.find(params[:category_id])
@products = Category.find(params[:category_id]).products.find(:all, :conditions => { :retired => false})
products = Category.find(params[:category_id]).products.find(:all, :conditions => { :retired => false})
rows = products.length / 5
@product_rows = []
rows.times do |i|
@product_rows << products.pop(5)
end
end
end
26 changes: 14 additions & 12 deletions app/views/categories_products/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
h3 = @category.name
br
ul class="thumbnails"
- @products.each do |product|
li class="span3"
a href=product_path(product) class="thumbnail"
- if product.photo.nil? || product.photo == ""
= image_tag('pug.jpg', :height => "200")
- else
= image_tag(product.photo, :height => "200")
p
strong = link_to product.title, product_path(product)
br
| $
= product.price
- @product_rows.each do |row|
div.row
div.span12
- row.each do |product|
li class="span2"
a href=product_path(product) class="thumbnail"
- if product.photo.nil? || product.photo == ""
= image_tag('pug.jpg')
- else
= image_tag product.photo
p
strong = link_to product.title, product_path(product)
br
| $#{product.price}

0 comments on commit 090d220

Please sign in to comment.