orbit-basic/config/initializers/override_and_new_class_meth...

26 lines
870 B
Ruby
Raw Permalink Normal View History

2011-02-08 09:25:20 +00:00
Integer.class_eval do
def to_b
!self.zero?
end
end
module SocialShareButton
module Helper
def social_share_button_tag(title = "", opts = {})
rel = opts[:rel]
html = []
html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}' data-fb_url='#{opts[:fb_url]}'>"
SocialShareButton.config.allow_sites.each do |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))
end
html << "</div>"
raw html.join("\n")
end
end
end