Sha256: 5a62bc6c245ee94e0b91af8df0064264783d4ceca3aa6b082d111690c51abe09

Contents?: true

Size: 1.5 KB

Versions: 24

Compression:

Stored size: 1.5 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
    	main_app.send(Auth::OmniAuth::Path.create_or_index_path(Auth.configuration.product_class))
    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

24 entries across 24 versions & 1 rubygems

Version Path
wordjelly-auth-1.2.2 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.2.1 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.2.0 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.9 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.8 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.7 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.6 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.5 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.4 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.3 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.2 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.1 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.1.0 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.9 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.8 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.5 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.4 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.3 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-1.0.2 app/helpers/auth/shopping/products/products_helper.rb
wordjelly-auth-0.0.8 app/helpers/auth/shopping/products/products_helper.rb