Module: SocialButtons::Helper
- Defined in:
- lib/social_buttons/helper.rb
Instance Method Summary collapse
-
#fb_like_button(options = {}) ⇒ Object
Facebook like button developers.facebook.com/docs/reference/plugins/like/.
-
#google_plus_button(options = {}) ⇒ Object
Google 1 button www.google.com/webmasters/+1/button/.
-
#pin_it_button(options = {}) ⇒ Object
Pinterest button pinterest.com/about/goodies/.
-
#twitter_share_button(options = {}) ⇒ Object
Twitter button twitter.com/about/resources/buttons Options: url, via, lang, size, related, hashtags, count.
Instance Method Details
#fb_like_button(options = {}) ⇒ Object
Facebook like button developers.facebook.com/docs/reference/plugins/like/
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/social_buttons/helper.rb', line 16 def (={}) href = [:url] || request.url params = .slice(:layout, :send, :width, :height, :show_faces, :action, :colorscheme, :font, :appId) params.reverse_merge!({:href => href, :layout => 'button_count', :send => false, :width => 450, :height => 21, :show_faces => false, :action => 'like', :colorscheme => 'light', :font => 'verdana' }) style = "border:none; overflow:hidden; width:#{params[:width]}px; height:#{params[:height]}px;" content_tag :iframe, '', :src => "//www.facebook.com/plugins/like.php?#{params.to_query}", :scrolling => 'no', :frameborder => 0, :allowTransparency => true, :style => style, :class => 'fb-like-btn' end |
#google_plus_button(options = {}) ⇒ Object
Google 1 button www.google.com/webmasters/+1/button/
52 53 54 55 56 57 58 |
# File 'lib/social_buttons/helper.rb', line 52 def (={}) href = [:url] || request.url = Hash[.map {|k, v| ["data-#{k}", v] }] .merge!({:class => 'g-plusone', 'data-href' => href}) content_tag :div, '', end |
#pin_it_button(options = {}) ⇒ Object
Pinterest button pinterest.com/about/goodies/
5 6 7 8 9 10 11 12 |
# File 'lib/social_buttons/helper.rb', line 5 def (={}) params = .slice(:url, :media, :description) params[:url] ||= request.url img = tag :img, :src => "//assets.pinterest.com/images/PinExt.png", :title => "Pin It", :border => "0" content_tag :a, img, "href" => "http://pinterest.com/pin/create/button/?#{params.to_query}", "class" => "pin-it-button", "count-layout" => "none" end |
#twitter_share_button(options = {}) ⇒ Object
Twitter button twitter.com/about/resources/buttons Options: url, via, lang, size, related, hashtags, count
43 44 45 46 47 48 |
# File 'lib/social_buttons/helper.rb', line 43 def (={}) = Hash[.map {|k, v| ["data-#{k}", v] }] .merge!({:href => 'https://twitter.com/share', :class => 'twitter-share-button'}) content_tag :a, 'Tweet', end |