sort products on homepage by date
Tom Rutgers
committed Aug 17, 2018
commit 67aa6db48439c7710289563ff91f6f8bb8fcc794
Showing 2
changed files with
12 additions
and 7 deletions
source/partials/homepage/_products.slim
+4
-2
| @@ | @@ -3,12 +3,14 @@ |
| h2 | |
| | Products | |
| .row | |
| - | - data.products.each do | product | |
| + | //product is structured: ['filename', 'data'] |
| + | //sort by newest product |
| + | - data.products.sort {|a,b| b[1].date <=> a[1].date}.each do | product | |
| - | //product is formatted ['filename', 'data'] |
| //to get the actual data: | |
| - product = product[1] | |
| + | //link to product by converting the title to a slug |
| = link_to '/products/' + product.title.parameterize | |
| .product | |
| .product-image | |
source/stylesheets/demo/products/_product.scss
+8
-5
| @@ | @@ -8,7 +8,7 @@ |
| .product-image, .product-content { | |
| background-color: #fff; | |
| } | |
| - | |
| + | |
| .product-content { | |
| padding: 10px 20px; | |
| } | |
| @@ | @@ -17,15 +17,18 @@ |
| display: inline-block; | |
| } | |
| + | .price p, h3 { |
| + | font-size: 24px; |
| + | font-weight: 700; |
| + | } |
| + | |
| .price { | |
| float: right; | |
| - | font-weight: 700; |
| - | color: $primary-color |
| + | font-size: 24px; |
| + | color: $primary-color; |
| } | |
| h3 { | |
| - | font-size: 18px; |
| - | font-weight: 700; |
| margin: 0; | |
| } | |
| } | |
| \ No newline at end of file | |