module ShareButton::Helper
Public Instance Methods
generate_link()
click to toggle source
# File lib/share_button/helper.rb, line 15 def generate_link @extra_data = {} @rel = @opts[:rel] if @opts[:allow_sites].class == Array @opts[:allow_sites].each do |name| links name end else links @opts[:allow_sites] end end
links(name)
click to toggle source
# File lib/share_button/helper.rb, line 27 def links 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) } special_data["data-wechat-footer"] = t "social_share_button.wechat_footer" if name == "wechat" link_title = "#{name.capitalize}" # "<img src='images/social-icon1.png' class='w-100'>" # 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 => @opts[:class], :onclick => "return ShareButton.share(this);", :title => h(link_title) }.merge(@extra_data).merge(special_data)) do @opts[:img].present? ? "<img src='#{@opts[:img][:src]}' class='#{@opts[:img][:class]}'>".html_safe : name.capitalize end end