Sha256: 97d1f9db7f53661816d66ccbf970458eaec52ee5856bf653d0f9ea6c066ce21f

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

module Flakey
  module GooglePlus
    # INFO: https://developers.google.com/+/plugins/+1button/
    def plus_one_button(options = {})
      size = options[:size] || nil
      annotation = options[:annotation] || 'inline'
      width = options[:width] || 300
      class_list = options[:class] || 'g-plusone'
      href = options[:href] || request.url
      callback = options[:callback] || nil

      data_attr = { annotation: annotation, href: href }
      # Width only applies to the 'inline' annotation type.
      data_attr.merge!(width: width) if annotation == 'inline'
      data_attr.merge!(size: size) if size
      data_attr.merge!(callback: callback) if callback

      content_tag :div, '', class: class_list, data: data_attr
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flakey-0.0.4 lib/flakey/google_plus.rb
flakey-0.0.3 lib/flakey/google_plus.rb
flakey-0.0.2 lib/flakey/google_plus.rb
flakey-0.0.1 lib/flakey/google_plus.rb