Permalink
Browse files

become better

  • Loading branch information...
1 parent aa53876 commit 75c8ebc60f0d7638c9622894f6576551743b7e5b @larryzhao committed Aug 9, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/social_share_button/helper.rb
@@ -10,11 +10,14 @@ def social_share_button_tag(title = "", opts = {})
SocialShareButton.config.allow_sites.each do |name,configs|
link_title = t "social_share_button.share_to", :name => t("social_share_button.#{name.downcase}")
+ parsed_title = title.gsub(/data_user/, configs[:user])
+ parsed_title.gsub!(/spot_name/, opts[:spot_name]) unless opts[:spot_name].nil?
+
link_content = name == 'weibo' ? configs[:link_content] : "<i class=\"icon-#{name}\"></i>".html_safe
html << link_to(link_content, "#", :rel => "nofollow #{rel}",
"data-site" => name,
"data-user" => configs[:user],
- "data-title" => title.gsub(/data_user/, configs[:user]).gsub(/spot_name/, opts[:spot_name] || ''),
+ "data-title" => parsed_title,
:onclick => "return SocialShareButton.share(this);",
:title => h(link_title))
end

0 comments on commit 75c8ebc

Please sign in to comment.