Adding a cart icon with count

This commit is contained in:
Will Marshall
2014-03-28 17:09:16 +11:00
parent 5d36dc5b4f
commit bda1ef5513
3 changed files with 25 additions and 2 deletions

View File

@@ -2,9 +2,19 @@
nav.top-bar
margin-bottom: 0px
a.icon
line-height: auto
font-size: 1.75em
&:hover
text-decoration: none
height: 45px
color: white
i
font-size: 29px
line-height: 45px
span
font-size: 13px
display: inline-block
line-height: 45px
height: 45px
vertical-align: top
body > section[role='main']
padding: 0px

View File

@@ -18,5 +18,9 @@ module Spree
def last_completed_order
spree_current_user.orders.complete.last
end
def cart_count
current_order.andand.line_items.count || 0
end
end
end

View File

@@ -10,3 +10,12 @@
= render 'shared/signed_out'
- else
= render 'shared/signed_in'
%section.top-bar-section
%ul.right
%li.cart
%a.icon{href: cart_url}
%i.fi-shopping-cart
%span
= cart_count
items