Sha256: 17e38d7c83384bd1c66ac03ad498764f267d6169cfb9ad338ce1ef1f84d43e6a

Contents?: true

Size: 1.52 KB

Versions: 35

Compression:

Stored size: 1.52 KB

Contents

module Auth::Shopping::Products::ProductsHelper


    ## @param[Auth::Shopping::Product] product
    ## @return[Auth::Shopping::CartItem] citem 
    def create_cart_item_from_product(product)
        citem = Auth.configuration.cart_item_class.constantize.new
        product.attributes.keys.each do |p_att|
            if citem.respond_to? p_att.to_sym
                unless (p_att == "_id" || p_att == "_type" || p_att == "resource_id" || p_att == "resource_class")  
                    citem.send("#{p_att}=",product.send("#{p_att}"))
                end
            end
        end
        citem.product_id = product.id.to_s
       
        citem
    end


    ##########################################################
    ##
    ##
    ## PATH HELPERS.
    ##
    ##
    ##########################################################


	## get /new
	def new_product_path
      main_app.send(Auth::OmniAuth::Path.new_path(Auth.configuration.product_class))
    end

    ## (PUT/PATCH/GET) - individual product
    def product_path(product)
    	
    	main_app.send(Auth::OmniAuth::Path.show_or_update_or_delete_path(Auth.configuration.product_class),product)
    end

	
	##/products (GET - all products /CREATE - individual product) 
	def products_path(params={})
    	main_app.send(Auth::OmniAuth::Path.create_or_index_path(Auth.configuration.product_class),params)
    end

    ##/shopping/products/:id/edit
    def edit_product_path(product)
    	main_app.send(Auth::OmniAuth::Path.edit_path(Auth.configuration.product_class),product)
    end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.9 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.8 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.7 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.6 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.5 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.4 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.3 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.2 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.1 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.5.0 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.9 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.8 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.7 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.6 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.5 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.4 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.3 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.2 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.4.0 app/helpers/auth/shopping/products/products_helper.rb