Module: Share::Helpers

Defined in:
lib/share/helpers.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/share/helpers.rb', line 3

def share_links text
  url = request.url
   :ul, :class => "share-container" do |content|
    { :twitter => "http://twitter.com/intent/tweet?&text=" + URI.encode("#{text} #{url}"),
      :facebook => "http://facebook.com/sharer.php?u=#{url}",
      "google-plus" => "https://plus.google.com/share?url=#{url}"}.map do |key, value|
        (:li,
          link_to("<i class=\"icon-fa-social icon-#{key}\"></i>".html_safe, value, :title => "Share on #{key.to_s.humanize}", :class => "share-link #{key}",
            "onclick" => "javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"
          ), :class => "share-item")
    end.join.html_safe
  end
end