Sha256: c504f06ac879ea667930d6a6fbabc1d89695084ee5bd2d4456a6fbe477b04035
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# coding: utf-8 module SocialShareButton module Helper def social_share_button_tag(title = "", opts = {}) opts[:allow_sites] ||= SocialShareButton.config.allow_sites extra_data = {} rel = opts[:rel] html = [] html << "<div class='social-share-button' data-title='#{h title}' data-img='#{opts[:image]}'" html << "data-url='#{opts[:url]}' data-desc='#{opts[:desc]}' data-popup='#{opts[:popup]}' data-via='#{opts[:via]}'>" opts[:allow_sites].each do |name| extra_data = opts.select { |k, _| k.to_s.start_with?('data') } if name.eql?('tumblr') special_data = opts.select { |k, _| k.to_s.start_with?('data-' + name) } link_title = t "social_share_button.share_to", :name => t("social_share_button.#{name.downcase}") html << link_to("","#", {:rel => ["nofollow", rel], "data-site" => name, :class => "social-share-button-#{name}", :onclick => "return SocialShareButton.share(this);", :title => h(link_title)}.merge(extra_data).merge(special_data)) end html << "</div>" raw html.join("\n") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
social-share-button-0.2.1 | lib/social_share_button/helper.rb |