Skip to content

Commit

Permalink
Cleaned and tightened
Browse files Browse the repository at this point in the history
  • Loading branch information
mdarby committed Aug 24, 2009
1 parent f03ad51 commit edc6175
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/socialite.rb
@@ -1,13 +1,13 @@
module Socialite

def socialite(options)
url = options[:url]
title = options[:title]

unless url.present? && title.present?
RAILS_DEFAULT_LOGGER.warn "Socialite requires a URL and title!"
else
links = {
else
links = {
:delicious => "http://www.delicious.com/post?url=#{url}&title=#{title}",
:digg => "http://www.digg.com/submit?url=#{url}&title=#{title}",
:facebook => "http://www.facebook.com/share.php?u=#{url}",
Expand All @@ -16,24 +16,24 @@ def socialite(options)
:technorati => "http://www.technorati.com/faves?add=#{url}&title=#{title}",
:twitter => "http://www.twitter.com/?status=#{title}: #{url}",
:email => "mailto:?subject=#{title}&body=#{title}: #{url}"
}.inject("") do |stack, (site, submit_url)|
stack << "<a href='#{submit_url}'><img src='/images/socialite/#{site}_16.png'></a>"
}.map do |(site, submit_url)|
"<a href='#{submit_url}'><img src='/images/socialite/#{site}_16.png'></a>"
end

<<-END
<div id="socialite">
<span class="advert">
<a href="http://github.com/mdarby/socialite">
Socialite
</a>
</span>
<div id="links">
#{links}
</div>
</div>
END
end

end
end
end

0 comments on commit edc6175

Please sign in to comment.