Module: Spree::PinterestHelper

Defined in:
app/helpers/spree/pinterest_helper.rb

Instance Method Summary collapse

Instance Method Details

#pin_it_button(product) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/spree/pinterest_helper.rb', line 3

def pin_it_button(product)
  return if product.images.empty?

  url = escape spree.product_url(product)
  media = escape absolute_image_url(product.images.first.attachment.url)
  description = escape product.name

  link_to("Pin It",
          "http://pinterest.com/pin/create/button/?url=#{url}&media=#{media}&description=#{description}",
          :class => "pin-it-button",
          "count-layout" => "horizontal").html_safe
end