Sha256: 00587b471ddd346e15a3a096f2a77d58cc4362ca36a880944540797a4ca55f3b

Contents?: true

Size: 813 Bytes

Versions: 96

Compression:

Stored size: 813 Bytes

Contents

module Piggybak
  class CartController < ApplicationController
    def show
      @cart = Cart.new(cookies["cart"])
      @cart.update_quantities
      cookies["cart"] = { :value => @cart.to_cookie, :path => '/' }
    end
  
    def add
      cookies["cart"] = { :value => Cart.add(cookies["cart"], params), :path => '/' }
      redirect_to piggybak.cart_url
    end
  
    def remove
      response.set_cookie("cart", { :value => Cart.remove(cookies["cart"], params[:item]), :path => '/' })
      redirect_to piggybak.cart_url
    end
  
    def clear
      cookies["cart"] = { :value => '', :path => '/' }
      redirect_to piggybak.cart_url
    end
  
    def update
      cookies["cart"] = { :value => Cart.update(cookies["cart"], params), :path => '/' }
      redirect_to piggybak.cart_url
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
piggybak-0.7.7 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.6 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.5 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.34 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.4 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.3 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.2 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.1 app/controllers/piggybak/cart_controller.rb
piggybak-0.7.0 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.33 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.32 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.31 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.30 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.29 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.28 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.27 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.26 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.25 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.24 app/controllers/piggybak/cart_controller.rb
piggybak-0.6.23 app/controllers/piggybak/cart_controller.rb