Sha256: e4c30080512a45fd9386319191307310a12791d64afe8582ea5e5de0ff749531
Contents?: true
Size: 658 Bytes
Versions: 3
Compression:
Stored size: 658 Bytes
Contents
module TbCommerce::ApplicationHelper def imageable_tag(imageable, params = { size: :tb_commerce_medium }) url = "" if !imageable #write a default image return end if imageable.is_a?(TbCommerce::Image) url = imageable.image.url(params[:size]) else imageable.is_a?(TbCommerce::Product) || imageable.is_a?(TbCommerce::Category) || imageable.is_a?(TbCommerce::ProductSku) featured_image = imageable.featured_image if featured_image url = featured_image.image.url(params[:size]) else url = imageable.images.first().image.url(params[:size]) end end image_tag(url) end end
Version data entries
3 entries across 3 versions & 1 rubygems