Module: PinIt::Helper

Defined in:
lib/pin_it.rb

Instance Method Summary collapse

Instance Method Details

#pin_it_button(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/pin_it.rb', line 10

def pin_it_button(options = {})
  %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="horizontal">Pin It</a>}
  query_params = options.slice(:url, :media, :description)
  layout_params = options[:count_layout]
  img = tag :img, :src => "//assets.pinterest.com/images/PinExt.png", :title => "Pin It", :border => "0" 
   :a, img, "href" => "http://pinterest.com/pin/create/button/?#{query_params.to_query}", 
                            "class" => "pin-it-button",
                            "count-layout" => layout_params || "horizontal"
end

#pin_it_jsObject



20
21
22
# File 'lib/pin_it.rb', line 20

def pin_it_js
  @pin_it_js ||= IO.read(File.expand_path("../../vendor/assets/javascripts/pin_it.js", __FILE__))
end