Sha256: 41b6d4b8fe8b0c63ba9d7adb9a0b7db4b49fc3392c7283917fab20e31615a3d2

Contents?: true

Size: 392 Bytes

Versions: 2

Compression:

Stored size: 392 Bytes

Contents

module ApplicationHelper
  def cart_form(object)
    render "piggybak/cart/form", :object => object
  end
  def cart_link
    cart = Piggybak::Cart.new(request.cookies["cart"]) 
    nitems = cart.items.inject(0) { |nitems, item| nitems + item[:quantity] }
    if nitems > 0
      link_to  "#{pluralize(nitems, 'item')}: #{number_to_currency(cart.total)}", piggybak.cart_url
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
piggybak-0.1.1 lib/application_helper.rb
piggybak-0.1.0 lib/application_helper.rb