sexy_bookmarks 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.rdoc +76 -0
  2. data/init.rb +2 -0
  3. data/lib/fixtures/socials.yml +246 -0
  4. data/lib/sexy_bookmarks.rb +74 -0
  5. data/lib/sexy_bookmarks_macros_helper.rb +58 -0
  6. data/lib/sexybookmarks/assets/images/sexybookmarks/custom-fugue-sprite.png +0 -0
  7. data/lib/sexybookmarks/assets/images/sexybookmarks/error-delete.jpg +0 -0
  8. data/lib/sexybookmarks/assets/images/sexybookmarks/flo-head.jpg +0 -0
  9. data/lib/sexybookmarks/assets/images/sexybookmarks/green-grad.png +0 -0
  10. data/lib/sexybookmarks/assets/images/sexybookmarks/information-delete.jpg +0 -0
  11. data/lib/sexybookmarks/assets/images/sexybookmarks/red-grad.png +0 -0
  12. data/lib/sexybookmarks/assets/images/sexybookmarks/share-enjoy.png +0 -0
  13. data/lib/sexybookmarks/assets/images/sexybookmarks/share-german.png +0 -0
  14. data/lib/sexybookmarks/assets/images/sexybookmarks/share-knowledge.png +0 -0
  15. data/lib/sexybookmarks/assets/images/sexybookmarks/share-love-hearts.png +0 -0
  16. data/lib/sexybookmarks/assets/images/sexybookmarks/share-wealth.png +0 -0
  17. data/lib/sexybookmarks/assets/images/sexybookmarks/shareaholic-220.png +0 -0
  18. data/lib/sexybookmarks/assets/images/sexybookmarks/sharing-caring-hearts.png +0 -0
  19. data/lib/sexybookmarks/assets/images/sexybookmarks/sharing-caring.png +0 -0
  20. data/lib/sexybookmarks/assets/images/sexybookmarks/sharing-shr.png +0 -0
  21. data/lib/sexybookmarks/assets/images/sexybookmarks/shr-sprite.png +0 -0
  22. data/lib/sexybookmarks/assets/images/sexybookmarks/shrsb-logo.png +0 -0
  23. data/lib/sexybookmarks/assets/images/sexybookmarks/success-delete.jpg +0 -0
  24. data/lib/sexybookmarks/assets/images/sexybookmarks/warning-big.png +0 -0
  25. data/lib/sexybookmarks/assets/images/sexybookmarks/warning-delete.jpg +0 -0
  26. data/lib/sexybookmarks/assets/images/sexybookmarks/white-pix.jpg +0 -0
  27. data/lib/sexybookmarks/assets/stylesheets/sexybookmarks/style.css +1 -0
  28. data/sexy_bookmarks.gemspec +17 -0
  29. data/test/sexy_bookmarks_test.rb +8 -0
  30. data/test/test_helper.rb +3 -0
  31. metadata +97 -0
data/README.rdoc ADDED
@@ -0,0 +1,76 @@
1
+ = SexyBookmarks
2
+ This plugin provides the installation and utilization of SexyBookmarks in Ruby on Rails applications of versions 2.3.5 - 2.3.8.
3
+ SexyBookmarks is a cool plugin for wordpress that includes list of social networks to publish content to by Shareaholic (http://sexybookmarks.shareaholic.com/)
4
+
5
+ == Installation
6
+ Installing SexyBookmarks is pretty simple and straight forward
7
+
8
+ == Installing as ruby gem
9
+
10
+ === Step 1
11
+ To install SexyBookmarks from rubygems jus do the following:
12
+
13
+ gem install sexy_bookmarks
14
+
15
+ === Step 2
16
+ Add the gem to your rails app like follows:
17
+
18
+ # without bundler add this to environment.rb
19
+ config.gem 'sexy_bookmarks'
20
+
21
+ # in bundler do it like this:
22
+ gem 'sexy_bookmarks'
23
+
24
+ == Installing as plugin
25
+
26
+ === Step 1
27
+ To install SexyBookmarks just do the following:
28
+
29
+ script/plugin install git://github.com/EnriqueVidal/sexy_bookmarks.git
30
+
31
+ And thats it SexyBookmarks, has already been installed
32
+
33
+ === Step 2
34
+ Add the following to the top of the controller of the page you want to add SexyBookmarks to.
35
+
36
+ uses_sexy_bookmarks
37
+
38
+ Then to display the list of links in your page just add this to your view:
39
+
40
+ <%= show_sexy_bookmarks :permalink => 'http://mycoolsite.com/my_cool_article', :title => @article.title %>
41
+
42
+ Lastly add the following to the <head> element of your application view:
43
+
44
+ include_sexy_bookmarks_if_needed
45
+
46
+ This will load the CSS needed by SexyBookmarks whenever its needed.
47
+
48
+ == Configuration
49
+ There are a couple of options you can easily tweak in Sexy bookmarks:
50
+
51
+ 1. You can choose which social networks to show
52
+ 2. You can set different text options for SexyBookmarks
53
+ 3. You can choose in what actions to load the SexyBookmarks CSS
54
+
55
+ == The SexyBookmarks parameters
56
+ The show_sexy_bookmarks method receives 3 parameters, this is what its signature looks like:
57
+
58
+ show_sexy_bookmarks(content, socials = nil, per_row = 8)
59
+
60
+ * The content parameter is a hash that contains, all the article text options such as title, permalink and post summary
61
+ * The socials parameter is an array that contains a collection of the social networks we wish to show
62
+ * Finally the per_row parameter is the number of social network icons that fit in your design, by default SexyBookmarks will use 100% of the space available, knowing how many links can fit is useful to properly show/hide the links upon hover
63
+
64
+ Only the first parameter is mandatory.
65
+
66
+ ==== Choosing your social networks
67
+ By default SexyBookmarks will show all the links available, however you can choose what links to show simply by passing the show_sexy_bookmarks an array of networks like this:
68
+
69
+ <%= show_sexy_bookmarks( options, [ :facebook, :linkedin, :googlebuzz, :myspace ] )
70
+
71
+ == Loading stylesheets only when necessary
72
+ The uses_sexy_bookmarks method on your controller set an instance variable to true which is the compared to load the CSS in your application layout, this method also takes a parameter:
73
+
74
+ uses_sexy_bookmarks :only => [ :show ]
75
+
76
+ This will ensure that the SexyBookmark CSS is only loaded when you visit the actions in the method's parameter.
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'sexy_bookmarks'
2
+ SexyBookmarks.initialize
@@ -0,0 +1,246 @@
1
+ scriptstyle:
2
+ url: 'http://scriptandstyle.com/submit?url=PERMALINK&amp;title=TITLE'
3
+ message: 'Submit this to Script &amp; Style'
4
+ blinklist:
5
+ url: 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=PERMALINK&amp;Title=TITLE'
6
+ message: 'Share this on Blinklist'
7
+ delicious:
8
+ url: 'http://delicious.com/post?url=PERMALINK&amp;title=TITLE'
9
+ message: 'Share this on del.icio.us'
10
+ digg:
11
+ url: 'http://digg.com/submit?phase=2&amp;url=PERMALINK&amp;title=TITLE'
12
+ message: 'Digg this!'
13
+ diigo:
14
+ url: 'http://www.diigo.com/post?url=PERMALINK&amp;title=TITLE&amp;desc=SEXY_TEASER'
15
+ message: 'Post this on Diigo'
16
+ reddit:
17
+ url: 'http://reddit.com/submit?url=PERMALINK&amp;title=TITLE'
18
+ message: 'Share this on Reddit'
19
+ yahoobuzz:
20
+ url: 'http://buzz.yahoo.com/submit/?submitUrl=PERMALINK&amp;submitHeadline=TITLE&amp;submitSummary=YAHOOTEASER&amp;submitCategory=YAHOOCATEGORY&amp;submitAssetType=YAHOOMEDIATYPE'
21
+ message: 'Buzz up!'
22
+ stumbleupon:
23
+ url: 'http://www.stumbleupon.com/submit?url=PERMALINK&amp;title=TITLE'
24
+ message: 'Stumble upon something good? Share it on StumbleUpon'
25
+ technorati:
26
+ url: 'http://www.stumbleupon.com/submit?url=PERMALINK&amp;title=TITLE'
27
+ message: 'Stumble upon something good? Share it on StumbleUpon'
28
+ mixx:
29
+ url: 'http://www.mixx.com/submit?page_url=PERMALINK&amp;title=TITLE'
30
+ message: 'Share this on Mixx'
31
+ myspace:
32
+ url: 'http://www.myspace.com/Modules/PostTo/Pages/?u=PERMALINK&amp;t=TITLE'
33
+ message: 'Post this to MySpace'
34
+ designfloat:
35
+ url: 'http://www.designfloat.com/submit.php?url=PERMALINK&amp;title=TITLE'
36
+ message: 'Submit this to DesignFloat'
37
+ facebook:
38
+ url: 'http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=PERMALINK&amp;t=TITLE'
39
+ message: 'Share this on Facebook'
40
+ twitter:
41
+ url: 'http://twitter.com/home?status='
42
+ message: 'Tweet This!'
43
+ linkedin:
44
+ url: 'http://www.linkedin.com/shareArticle?mini=true&amp;url=PERMALINK&amp;title=TITLE&amp;summary=POST_SUMMARY&amp;source=SITE_NAME'
45
+ message: 'Share this on LinkedIn'
46
+ newsvine:
47
+ url: 'http://www.newsvine.com/_tools/seed&amp;save?u=PERMALINK&amp;h=TITLE'
48
+ message: 'Seed this on Newsvine'
49
+ googlebookmarks:
50
+ url: 'http://www.google.com/bookmarks/mark?op=add&amp;bkmk=PERMALINK&amp;title=TITLE'
51
+ message: 'Add this to Google Bookmarks'
52
+ googlereader:
53
+ url: 'http://www.google.com/reader/link?url=PERMALINK&amp;title=TITLE&amp;srcUrl=PERMALINK&amp;srcTitle=TITLE&amp;snippet=POST_SUMMARY'
54
+ message: 'Add this to Google Reader'
55
+ googlebuzz:
56
+ url: 'http://www.google.com/buzz/post?url=PERMALINK&amp;imageurl='
57
+ message: 'Post on Google Buzz'
58
+ izeby:
59
+ url: 'http://izeby.com/submit.php?url=PERMALINK'
60
+ message: 'Add this to Izeby'
61
+ tipd:
62
+ url: 'http://tipd.com/submit.php?url=PERMALINK'
63
+ message: 'Share this on Tipd'
64
+ pfbuzz:
65
+ url: 'http://pfbuzz.com/submit?url=PERMALINK&amp;title=TITLE'
66
+ message: 'Share this on PFBuzz'
67
+ friendfeed:
68
+ url: 'http://www.friendfeed.com/share?title=TITLE&amp;link=PERMALINK'
69
+ message: 'Share this on FriendFeed'
70
+ blogmarks:
71
+ url: 'http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=PERMALINK&amp;title=TITLE'
72
+ message: 'Mark this on BlogMarks'
73
+ twittley:
74
+ url: 'http://twittley.com/submit/?title=TITLE&amp;url=PERMALINK&amp;desc=POST_SUMMARY&amp;pcat=TWITT_CAT&amp;tags=DEFAULT_TAGS'
75
+ message: 'Submit this to Twittley'
76
+ fwisp:
77
+ url: 'http://fwisp.com/submit?url=PERMALINK'
78
+ message: 'Share this on Fwisp'
79
+ bobrdobr:
80
+ url: 'http://bobrdobr.ru/addext.html?url=PERMALINK&amp;title=TITLE'
81
+ message: 'Share this on BobrDobr'
82
+ yandex:
83
+ url: 'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&amp;lurl=PERMALINK&amp;lname=TITLE'
84
+ message: 'Yandex.Bookmarks'
85
+ memoryru:
86
+ url: 'http://memori.ru/link/?sm=1&amp;u_data[url]=PERMALINK&amp;u_data[name]=TITLE'
87
+ message: 'Add this to Memory.ru'
88
+ 100zakladok:
89
+ url: 'http://www.100zakladok.ru/save/?bmurl=PERMALINK&amp;bmtitle=TITLE'
90
+ message: 'Add this to 100 bookmarks'
91
+ moemesto:
92
+ url: 'http://moemesto.ru/post.php?url=PERMALINK&amp;title=TITLE'
93
+ message: 'Add this to MyPlace'
94
+ hackernews:
95
+ url: 'http://news.ycombinator.com/submitlink?u=PERMALINK&amp;t=TITLE'
96
+ message: 'Submit this to Hacker News'
97
+ printfriendly:
98
+ url: 'http://www.printfriendly.com/print?url=PERMALINK'
99
+ message: 'Send this page to Print Friendly'
100
+ designbump:
101
+ url: 'http://designbump.com/submit?url=PERMALINK&amp;title=TITLE&amp;body=POST_SUMMARY'
102
+ message: 'Bump this on DesignBump'
103
+ ning:
104
+ url: 'http://bookmarks.ning.com/addItem.php?url=PERMALINK&amp;T=TITLE'
105
+ message: 'Add this to Ning'
106
+ identica:
107
+ url: 'http://identi.ca//index.php?action=newnotice&amp;status_textarea=Reading:+&quot;SHORT_TITLE&quot;+-+from+FETCH_URL'
108
+ message: 'Save this to Xerpi'
109
+ xerpi:
110
+ url: 'http://www.xerpi.com/block/add_link_from_extension?url=PERMALINK&amp;title=TITLE'
111
+ message: 'Save this to Xerpi'
112
+ wikio:
113
+ url: 'http://www.wikio.com/sharethis?url=PERMALINK&amp;title=TITLE'
114
+ message: 'Share this on Wikio'
115
+ techmeme:
116
+ url: 'http://twitter.com/home/?status=Tip+@Techmeme+PERMALINK+&quot;TITLE&quot;&amp;source=shareaholic'
117
+ message: 'Tip this to TechMeme'
118
+ sphinn:
119
+ url: 'http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=PERMALINK'
120
+ message: 'Sphinn this on Sphinn'
121
+ posterous:
122
+ url: 'http://posterous.com/share?linkto=PERMALINK&amp;title=TITLE&amp;selection=POST_SUMMARY'
123
+ message: 'Post this to Posterous'
124
+ globalgrind:
125
+ url: 'http://globalgrind.com/submission/submit.aspx?url=PERMALINK&amp;type=Article&amp;title=TITLE'
126
+ message: 'Grind this! on Global Grind'
127
+ pingfm:
128
+ url: 'http://ping.fm/ref/?link=PERMALINK&amp;title=TITLE&amp;body=POST_SUMMARY'
129
+ message: 'Ping this on Ping.fm'
130
+ nujij:
131
+ url: 'http://nujij.nl/jij.lynkx?t=TITLE&amp;u=PERMALINK&amp;b=POST_SUMMARY'
132
+ message: 'Submit this to NUjij'
133
+ ekudos:
134
+ url: 'http://www.ekudos.nl/artikel/nieuw?url=PERMALINK&amp;title=TITLE&amp;desc=POST_SUMMARY'
135
+ message: 'Submit this to eKudos'
136
+ netvouz:
137
+ url: 'http://www.netvouz.com/action/submitBookmark?url=PERMALINK&amp;title=TITLE&amp;popup=no'
138
+ message: 'Submit this to Netvouz'
139
+ netvibes:
140
+ url: 'http://www.netvibes.com/share?title=TITLE&amp;url=PERMALINK'
141
+ message: 'Submit this to Netvibes'
142
+ webblend:
143
+ url: 'http://thewebblend.com/submit?url=PERMALINK&amp;title=TITLE&amp;body=POST_SUMMARY'
144
+ message: 'Blend this!'
145
+ wykop:
146
+ url: 'http://www.wykop.pl/dodaj?url=PERMALINK&amp;title=TITLE'
147
+ message: 'Add this to Wykop!'
148
+ blogengage:
149
+ url: 'http://www.blogengage.com/submit.php?url=PERMALINK'
150
+ message: 'Engage this article!'
151
+ hyves:
152
+ url:'http://www.hyves.nl/profilemanage/add/tips/?name=TITLE&amp;text=POST_SUMMARY+-+PERMALINK&amp;rating=5'
153
+ message: 'Share this on Hyves'
154
+ pusha:
155
+ url: 'http://www.pusha.se/posta?url=PERMALINK&amp;title=TITLE'
156
+ message: 'Push this on Pusha'
157
+ hatena:
158
+ url: 'http://b.hatena.ne.jp/add?mode=confirm&amp;url=PERMALINK&amp;title=TITLE'
159
+ message: 'Bookmark this on Hatena Bookmarks'
160
+ mylinkvault:
161
+ url: 'http://www.mylinkvault.com/link-page.php?u=PERMALINK&amp;n=TITLE'
162
+ message: 'Store this link on MyLinkVault'
163
+ slashdot:
164
+ url: 'http://slashdot.org/bookmark.pl?url=PERMALINK&amp;title=TITLE'
165
+ message: 'Submit this to SlashDot'
166
+ squidoo:
167
+ url: 'http://www.squidoo.com/lensmaster/bookmark?PERMALINK'
168
+ message: 'Add this to a lense on Squidoo'
169
+ propeller:
170
+ url: 'http://www.propeller.com/submit/?url=PERMALINK'
171
+ message: 'Submit this story to Propeller'
172
+ faqpal:
173
+ url: 'http://www.faqpal.com/submit?url=PERMALINK'
174
+ message: 'Submit this to FAQpal'
175
+ evernote:
176
+ url: 'http://www.evernote.com/clip.action?url=PERMALINK&amp;title=TITLE'
177
+ message: 'Clip this to Evernote'
178
+ meneame:
179
+ url: 'http://meneame.net/submit.php?url=PERMALINK'
180
+ message: 'Submit this to Meneame'
181
+ bitacoras:
182
+ url: 'http://bitacoras.com/anotaciones/PERMALINK'
183
+ message: 'Submit this to bitacoras'
184
+ jumptags:
185
+ url: 'http://www.jumptags.com/add/?url=PERMALINK&amp;title=TITLE'
186
+ message: 'Submit this link to JumpTags'
187
+ bebo:
188
+ url: 'http://www.bebo.com/c/share?Url=PERMALINK&amp;Title=TITLE'
189
+ message: 'Share this on Bebo'
190
+ n4g:
191
+ url: 'http://www.n4g.com/tips.aspx?url=PERMALINK&amp;title=TITLE'
192
+ message: 'Submit tip to N4G'
193
+ strands:
194
+ url: 'http://www.strands.com/tools/share/webpage?title=TITLE&amp;url=PERMALINK'
195
+ message: 'Submit this to Strands'
196
+ orkut:
197
+ url: 'http://promote.orkut.com/preview?nt=orkut.com&amp;tt=TITLE&amp;du=PERMALINK&amp;cn=POST_SUMMARY'
198
+ message: 'Promote this on Orkut'
199
+ tumblr:
200
+ url: 'http://www.tumblr.com/share?v=3&amp;u=PERMALINK&amp;t=TITLE'
201
+ message: 'Share this on Tumblr'
202
+ stumpedia:
203
+ url: 'http://www.stumpedia.com/submit?url=PERMALINK&amp;title=TITLE'
204
+ message: 'Add this to Stumpedia'
205
+ current:
206
+ url: 'http://current.com/clipper.htm?url=PERMALINK&amp;title=TITLE'
207
+ message: 'Post this on Current'
208
+ blogger:
209
+ url: 'http://www.blogger.com/blog_this.pyra?t&amp;u=PERMALINK&amp;n=TITLE&amp;pli=1'
210
+ message: 'Blog this on Blogger'
211
+ plurk:
212
+ url: 'http://www.plurk.com/m?content=TITLE+-+PERMALINK&amp;qualifier=shares'
213
+ message: 'Share this on Plurk'
214
+ dzone:
215
+ url: 'http://www.dzone.com/links/add.html?url=PERMALINK&amp;title=TITLE&amp;description=POST_SUMMARY'
216
+ message: 'Add this to DZone'
217
+ kaevur:
218
+ url: 'http://kaevur.com/submit.php?url=PERMALINK'
219
+ message: 'Share this on Kaevur'
220
+ virb:
221
+ url: 'http://virb.com/share?external&amp;v=2&amp;url=PERMALINK&amp;title=TITLE'
222
+ message: 'Share this on Virb'
223
+ boxnet:
224
+ url: 'https://www.box.net/api/1.0/import?url=PERMALINK&amp;name=TITLE&amp;description=POST_SUMMARY&amp;import_as=link'
225
+ message: 'Add this link to Box.net'
226
+ oknotizie:
227
+ url: 'http://oknotizie.virgilio.it/post?url=PERMALINK&amp;title=TITLE'
228
+ message: 'Share this on OkNotizie'
229
+ bonzobox:
230
+ url: 'http://bonzobox.com/toolbar/add?pop=1&amp;u=PERMALINK&amp;t=TITLE&amp;d=POST_SUMMARY'
231
+ message: 'Add this to BonzoBox'
232
+ plaxo:
233
+ url: 'http://www.plaxo.com/?share_link=PERMALINK'
234
+ message: 'Share this on Plaxo'
235
+ springpad:
236
+ url: 'http://springpadit.com/clip.action?body=POST_SUMMARY&amp;url=PERMALINK&amp;format=microclip&amp;title=TITLE&amp;isSelected=true'
237
+ message: 'Spring this on SpringPad'
238
+ zabox:
239
+ url: 'http://www.zabox.net/submit.php?url=PERMALINK'
240
+ message: 'Box this on Zabox'
241
+ viadeo:
242
+ url: 'http://www.viadeo.com/shareit/share/?url=PERMALINK&amp;title=TITLE&amp;urlaffiliate=31138'
243
+ message: 'Share this on Viadeo'
244
+ buzzster:
245
+ url: "javascript:var%20s=document.createElement('script');s.src='http://www.buzzster.com/javascripts/bzz_adv.js';s.type='text/javascript';void(document.getElementsByTagName('head')[0].appendChild(s));"
246
+ message: 'Buzzter!'
@@ -0,0 +1,74 @@
1
+ module SexyBookmarks
2
+ def self.included(base)
3
+ base.extend(ClassMethods)
4
+ end
5
+
6
+ def self.initialize
7
+ return if @intialized
8
+
9
+ SexyBookmarks.install
10
+ @intialized = true
11
+ end
12
+
13
+ def self.install
14
+ require 'fileutils'
15
+ original_stylesheets = File.join(File.dirname(__FILE__), 'sexybookmarks', 'assets', 'stylesheets', 'sexybookmarks' )
16
+ original_images = File.join(File.dirname(__FILE__), 'sexybookmarks', 'assets', 'images', 'sexybookmarks' )
17
+ destination = File.join(Rails.root.to_s, 'public')
18
+
19
+ stylesheet_dest = File.join(destination, 'stylesheets', 'sexybookmarks')
20
+ stylesheet = File.join(stylesheet_dest, 'style.css')
21
+
22
+ images_dest = File.join(destination, 'images', 'sexybookmarks')
23
+
24
+ unless File.exists?( stylesheet ) && FileUtils.identical?( File.join( original_stylesheets, 'style.css' ), stylesheet )
25
+ if !File.exists?( stylesheet )
26
+ begin
27
+ puts "Creating directory #{stylesheet_dest}..."
28
+ FileUtils.mkdir_p stylesheet_dest
29
+ puts "Copying SexyBookmarks CSS to #{stylesheet_dest}..."
30
+ FileUtils.cp_r "#{original_stylesheets}/.", stylesheet_dest
31
+ puts "Successfully copied SexyBookmarks css."
32
+ rescue
33
+ puts "ERROR: Problem installing SexyBookmarks. Please manually copy "
34
+ puts stylesheet
35
+ puts "to"
36
+ puts stylesheet_dest
37
+ end
38
+ end
39
+ end
40
+
41
+ unless File.exists?(images_dest)
42
+ begin
43
+ puts "Creating directory #{images_dest}..."
44
+ FileUtils.mkdir_p images_dest
45
+ puts "Copying SexyBookmarks images to #{images_dest}"
46
+ FileUtils.cp_r "#{original_images}/.", images_dest
47
+ puts "Successfully copied SexyBookmarks images"
48
+ rescue
49
+ puts "ERROR: Problem installing SexyBookmarks. Please manually copy the images in"
50
+ puts original_images
51
+ puts "to"
52
+ puts images_dest
53
+ end
54
+ end
55
+ end
56
+
57
+ module ClassMethods
58
+ def uses_sexy_bookmarks(options = {})
59
+ proc = Proc.new do |current_class|
60
+ current_class.instance_variable_set(:@uses_sexy_bookmarks, true)
61
+ end
62
+
63
+ before_filter(proc, options)
64
+ end
65
+ end
66
+
67
+ self.initialize
68
+
69
+ end
70
+
71
+ class ActionController::Base
72
+ include SexyBookmarks
73
+ self.helper SexyBookmarksMacrosHelper
74
+ end
@@ -0,0 +1,58 @@
1
+ module SexyBookmarksMacrosHelper
2
+
3
+ def available_social_networks
4
+ if @available_socials.nil?
5
+ socials = File.new( File.join(File.dirname(__FILE__), 'fixtures', 'socials.yml') )
6
+ @available_socials = YAML::load socials
7
+ socials.close
8
+ end
9
+
10
+ @available_socials
11
+ end
12
+
13
+ def show_sexy_bookmarks( content, socials = nil, per_row = 8 )
14
+ socials = available_social_networks.keys if socials.nil?
15
+
16
+ list_items = socials.collect do |social|
17
+
18
+ link_url = available_social_networks[social.to_s]['url'].to_s.gsub( /SHORT_TITLE|TITLE/, content[:title].to_s )
19
+ link_url = link_url.gsub( /FETCH_URL|PERMALINK/, content[:permalink].to_s )
20
+ link_url = link_url.gsub( /POST_SUMMARY|SEXY_TEASER/, content[:post_summary].to_s ).gsub(/SITE_NAME/, content[:site_name].to_s )
21
+ link_url = link_url.gsub( /TWITT_CAT/, content[:twitt_cat].to_s ).gsub( /DEFAULT_TAGS/, content[:default_tags].to_s )
22
+ link_url = link_url.gsub( /YAHOOTEASER/, content[:yahooteaser].to_s ).gsub( /YAHOOCATEGORY/, content[:yahoocategory].to_s )
23
+ link_url = link_url.gsub( /YAHOOMEDIATYPE/, content[:yahoomediatype].to_s )
24
+
25
+ link_options = {
26
+ :href => link_url,
27
+ :rel => :nofollow,
28
+ :title => available_social_networks[social.to_s]['message'],
29
+ :class => :external
30
+ }
31
+ link = content_tag( 'a', available_social_networks[social.to_s]['message'], link_options )
32
+ content_tag( 'li', link, :class => 'shr-' + social.to_s )
33
+ end
34
+
35
+ unordered_list = content_tag( 'ul', list_items, :class => 'socials' )
36
+ content_tag( 'div', unordered_list, { :class => 'shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-shr', :id => 'sexybookmarks' } ) + reveal_social_list(socials.count, per_row)
37
+ end
38
+
39
+ def include_sexy_bookmarks_if_needed
40
+ stylesheet_link_tag "sexybookmarks/style.css" if @uses_sexy_bookmarks
41
+ end
42
+
43
+ def reveal_social_list(total, per_row)
44
+ rows = ( total / Float(per_row ) % 2 == 0 ) ? total / per_row : ( total / per_row ) + 1
45
+ javascript = %{
46
+ $(document).ready(function() {
47
+ $(".socials").hover(function(){
48
+ $("#sexybookmarks").delay(500).animate({ height: "#{rows*32}px" }, 750);
49
+ },
50
+ function(){
51
+ $("#sexybookmarks").animate({ height: "32px"}, 750);
52
+ });
53
+ });
54
+ }
55
+
56
+ content_tag('script', javascript, :type => 'text/javascript')
57
+ end
58
+ end
@@ -0,0 +1 @@
1
+ div.shr-bookmarks{margin:20px 0;clear:both !important}div.shr-bookmarks-expand{height:32px;overflow:hidden}div.shr-bookmarks-bg-shr{padding:28px 0 0 10px !important;background:transparent url('/images/sexybookmarks/sharing-shr.png') no-repeat !important}div.shr-bookmarks-bg-caring{padding:26px 0 0 10px !important;background:transparent url('/images/sexybookmarks/sharing-caring-hearts.png') no-repeat !important}div.shr-bookmarks-bg-caring-old{padding:26px 0 0 10px !important;background:transparent url('/images/sexybookmarks/sharing-caring.png') no-repeat !important}div.shr-bookmarks-bg-love{padding:26px 0 0 10px !important;background:transparent url('/images/sexybookmarks/share-love-hearts.png') no-repeat !important}div.shr-bookmarks-bg-wealth{margin-left:15px !important;padding:35px 0 0 20px !important;background:transparent url('/images/sexybookmarks/share-wealth.png') no-repeat !important}div.shr-bookmarks-bg-enjoy{padding:26px 0 0 10px !important;background:transparent url('/images/sexybookmarks/share-enjoy.png') no-repeat !important}div.shr-bookmarks-bg-german{padding:35px 0 0 20px !important;background:transparent url('/images/sexybookmarks/share-german.png') no-repeat !important}div.shr-bookmarks-bg-knowledge{padding:35px 0 0 10px !important;background:transparent url('/images/sexybookmarks/share-knowledge.png') no-repeat !important}div.shr-bookmarks ul.socials{width:100% !important;margin:0 !important;padding:0 !important;float:left !important;background:transparent none !important;border:0 none !important;outline:0 none !important}div.shr-bookmarks ul.socials li{background-image:url('/images/sexybookmarks/shr-sprite.png') !important;background-repeat:no-repeat !important;display:inline !important;float:left !important;list-style-type:none !important;padding:0 !important;height:29px !important;width:60px !important;cursor:pointer !important;margin:3px 0 0 !important;background-color:transparent !important;border:0 none !important;outline:0 none !important;clear:none !important}div.shr-bookmarks ul.socials li:before,div.shr-bookmarks ul.socials li:after,div.shr-bookmarks ul.socials li a:before,div.shr-bookmarks ul.socials li a:after{content:'' !important}div.shr-bookmarks ul.socials a,div.shr-bookmarks ul.socials a:hover{display:block !important;width:60px !important;height:29px !important;text-indent:-9999px !important;background-color:transparent !important;text-decoration:none !important;border:0 none !important;margin:0 !important;padding:0 !important}div.shr-bookmarks ul.socials a:hover,div.shr-bookmarks ul.socials li:hover{background-color:transparent !important;border:0 none !important;outline:0 none !important}li.shr-newsvine{background-position:left bottom !important}li.shr-newsvine:hover{background-position:left top !important}li.shr-linkedin{background-position:-70px bottom !important}li.shr-linkedin:hover{background-position:-70px top !important}li.shr-googlebookmarks{background-position:-140px bottom !important}li.shr-googlebookmarks:hover{background-position:-140px top !important}li.shr-googlereader{background-position:-210px bottom !important}li.shr-googlereader:hover{background-position:-210px top !important}li.shr-scriptstyle{background-position:-280px bottom !important}li.shr-scriptstyle:hover{background-position:-280px top !important}li.shr-mail{background-position:-350px bottom !important}li.shr-mail:hover{background-position:-350px top !important}li.shr-comfeed{background-position:-420px bottom !important}li.shr-comfeed:hover{background-position:-420px top !important}li.shr-twitter{background-position:-490px bottom !important}li.shr-twitter:hover{background-position:-490px top !important}li.shr-technorati{background-position:-560px bottom !important}li.shr-technorati:hover{background-position:-560px top !important}li.shr-stumbleupon{background-position:-630px bottom !important}li.shr-stumbleupon:hover{background-position:-630px top !important}li.shr-reddit{background-position:-700px bottom !important}li.shr-reddit:hover{background-position:-700px top !important}li.shr-myspace{background-position:-770px bottom !important}li.shr-myspace:hover{background-position:-770px top !important}li.shr-mixx{background-position:-840px bottom !important}li.shr-mixx:hover{background-position:-840px top !important}li.shr-diigo{background-position:-910px bottom !important}li.shr-diigo:hover{background-position:-910px top !important}li.shr-digg{background-position:-980px bottom !important}li.shr-digg:hover{background-position:-980px top !important}li.shr-designfloat{background-position:-1050px bottom !important}li.shr-designfloat:hover{background-position:-1050px top !important}li.shr-yahoobuzz{background-position:-1120px bottom !important}li.shr-yahoobuzz:hover{background-position:-1120px top !important}li.shr-delicious{background-position:-1190px bottom !important}li.shr-delicious:hover{background-position:-1190px top !important}li.shr-blinklist{background-position:-1260px bottom !important}li.shr-blinklist:hover{background-position:-1260px top !important}li.shr-facebook{background-position:-1330px bottom !important}li.shr-facebook:hover{background-position:-1330px top !important}li.shr-misterwong{background-position:-1400px bottom !important}li.shr-misterwong:hover{background-position:-1400px top !important}li.shr-izeby{background-position:-1470px bottom !important}li.shr-izeby:hover{background-position:-1470px top !important}li.shr-twittley{background-position:-1540px bottom !important}li.shr-twittley:hover{background-position:-1540px top !important}li.shr-tipd{background-position:-1610px bottom !important}li.shr-tipd:hover{background-position:-1610px top !important}li.shr-pfbuzz{background-position:-1680px bottom !important}li.shr-pfbuzz:hover{background-position:-1680px top !important}li.shr-friendfeed{background-position:-1750px bottom !important}li.shr-friendfeed:hover{background-position:-1750px top !important}li.shr-blogmarks{background-position:-1820px bottom !important}li.shr-blogmarks:hover{background-position:-1820px top !important}li.shr-fwisp{background-position:-1890px bottom !important}li.shr-fwisp:hover{background-position:-1890px top !important}li.shr-yahoomail{background-position:-1960px bottom !important}li.shr-yahoomail:hover{background-position:-1960px top !important}li.shr-bobrdobr{background-position:-2030px bottom !important}li.shr-bobrdobr:hover{background-position:-2030px top !important}li.shr-memoryru{background-position:-2100px bottom !important}li.shr-memoryru:hover{background-position:-2100px top !important}li.shr-100zakladok{background-position:-2170px bottom !important}li.shr-100zakladok:hover{background-position:-2170px top !important}li.shr-yandex{background-position:-2240px bottom !important}li.shr-yandex:hover{background-position:-2240px top !important}li.shr-moemesto{background-position:-2310px bottom !important}li.shr-moemesto:hover{background-position:-2310px top !important}li.shr-marrows{background-position:-2380px bottom !important}li.shr-marrows:hover{background-position:-2380px top !important}li.shr-identica{background-position:-2450px bottom !important}li.shr-identica:hover{background-position:-2450px top !important}li.shr-hackernews{background-position:-2520px bottom !important}li.shr-hackernews:hover{background-position:-2520px top !important}li.shr-ning{background-position:-2590px bottom !important}li.shr-ning:hover{background-position:-2590px top !important}li.shr-designbump{background-position:-2660px bottom !important}li.shr-designbump:hover{background-position:-2660px top !important}li.shr-printfriendly{background-position:-2730px bottom !important}li.shr-printfriendly:hover{background-position:-2730px top !important}li.shr-fleck{background-position:-2800px bottom !important}li.shr-fleck:hover{background-position:-2800px top !important}li.shr-netvibes{background-position:-2870px bottom !important}li.shr-netvibes:hover{background-position:-2870px top !important}li.shr-netvouz{background-position:-2940px bottom !important}li.shr-netvouz:hover{background-position:-2940px top !important}li.shr-nujij{background-position:-3010px bottom !important}li.shr-nujij:hover{background-position:-3010px top !important}li.shr-globalgrind{background-position:-3080px bottom !important}li.shr-globalgrind:hover{background-position:-3080px top !important}li.shr-wikio{background-position:-3150px bottom !important}li.shr-wikio:hover{background-position:-3150px top !important}li.shr-xerpi{background-position:-3220px bottom !important}li.shr-xerpi:hover{background-position:-3220px top !important}li.shr-sphinn{background-position:-3290px bottom !important}li.shr-sphinn:hover{background-position:-3290px top !important}li.shr-hotmail{background-position:-3360px bottom !important}li.shr-hotmail:hover{background-position:-3360px top !important}li.shr-posterous{background-position:-3430px bottom !important}li.shr-posterous:hover{background-position:-3430px top !important}li.shr-techmeme{background-position:-3500px bottom !important}li.shr-techmeme:hover{background-position:-3500px top !important}li.shr-ekudos{background-position:-3570px bottom !important}li.shr-ekudos:hover{background-position:-3570px top !important}li.shr-pingfm{background-position:-3640px bottom !important}li.shr-pingfm:hover{background-position:-3640px top !important}li.shr-tomuse{background-position:-3710px bottom !important}li.shr-tomuse:hover{background-position:-3710px top !important}li.shr-webblend{background-position:-3780px bottom !important}li.shr-webblend:hover{background-position:-3780px top !important}li.shr-wykop{background-position:-3850px bottom !important}li.shr-wykop:hover{background-position:-3850px top !important}li.shr-blogengage{background-position:-3920px bottom !important}li.shr-blogengage:hover{background-position:-3920px top !important}li.shr-hyves{background-position:-3990px bottom !important}li.shr-hyves:hover{background-position:-3990px top !important}li.shr-pusha{background-position:-4060px bottom !important}li.shr-pusha:hover{background-position:-4060px top !important}li.shr-hatena{background-position:-4130px bottom !important}li.shr-hatena:hover{background-position:-4130px top !important}li.shr-mylinkvault{background-position:-4200px bottom !important}li.shr-mylinkvault:hover{background-position:-4200px top !important}li.shr-slashdot{background-position:-4270px bottom !important}li.shr-slashdot:hover{background-position:-4270px top !important}li.shr-squidoo{background-position:-4340px bottom !important}li.shr-squidoo:hover{background-position:-4340px top !important}li.shr-propeller{background-position:-4410px bottom !important}li.shr-propeller:hover{background-position:-4410px top !important}li.shr-faqpal{background-position:-4480px bottom !important}li.shr-faqpal:hover{background-position:-4480px top !important}li.shr-evernote{background-position:-4550px bottom !important}li.shr-evernote:hover{background-position:-4550px top !important}li.shr-meneame{background-position:-4620px bottom !important}li.shr-meneame:hover{background-position:-4620px top !important}li.shr-bitacoras{background-position:-4690px bottom !important}li.shr-bitacoras:hover{background-position:-4690px top !important}li.shr-jumptags{background-position:-4760px bottom !important}li.shr-jumptags:hover{background-position:-4760px top !important}li.shr-bebo{background-position:-4830px bottom !important}li.shr-bebo:hover{background-position:-4830px top !important}li.shr-n4g{background-position:-4900px bottom !important}li.shr-n4g:hover{background-position:-4900px top !important}li.shr-strands{background-position:-4970px bottom !important}li.shr-strands:hover{background-position:-4970px top !important}li.shr-orkut{background-position:-5040px bottom !important}li.shr-orkut:hover{background-position:-5040px top !important}li.shr-tumblr{background-position:-5110px bottom !important}li.shr-tumblr:hover{background-position:-5110px top !important}li.shr-stumpedia{background-position:-5180px bottom !important}li.shr-stumpedia:hover{background-position:-5180px top !important}li.shr-current{background-position:-5250px bottom !important}li.shr-current:hover{background-position:-5250px top !important}li.shr-blogger{background-position:-5320px bottom !important}li.shr-blogger:hover{background-position:-5320px top !important}li.shr-plurk{background-position:-5390px bottom !important}li.shr-plurk:hover{background-position:-5390px top !important}li.shr-virb{background-position:-5460px bottom !important}li.shr-virb:hover{background-position:-5460px top !important}li.shr-dzone{background-position:-5530px bottom !important}li.shr-dzone:hover{background-position:-5530px top !important}li.shr-kaevur{background-position:-5600px bottom !important}li.shr-kaevur:hover{background-position:-5600px top !important}li.shr-boxnet{background-position:-5670px bottom !important}li.shr-boxnet:hover{background-position:-5670px top !important}li.shr-oknotizie{background-position:-5740px bottom !important}li.shr-oknotizie:hover{background-position:-5740px top !important}li.shr-bonzobox{background-position:-5810px bottom !important}li.shr-bonzobox:hover{background-position:-5810px top !important}li.shr-plaxo{background-position:-5880px bottom !important}li.shr-plaxo:hover{background-position:-5880px top !important}li.shr-springpad{background-position:-5950px bottom !important}li.shr-springpad:hover{background-position:-5950px top !important}li.shr-zabox{background-position:-6020px bottom !important}li.shr-zabox:hover{background-position:-6020px top !important}li.shr-viadeo{background-position:-6090px bottom !important}li.shr-viadeo:hover{background-position:-6090px top !important}li.shr-googlebuzz{background-position:-6160px bottom !important}li.shr-googlebuzz:hover{background-position:-6160px top !important}li.shr-gmail{background-position:-6230px bottom !important}li.shr-gmail:hover{background-position:-6230px top !important}li.shr-buzzster{background-position:-6300px bottom !important}li.shr-buzzster:hover{background-position:-6300px top !important}
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = "sexy_bookmarks"
3
+ gem.version = "0.1"
4
+ gem.authors = [ "Enrique Vidal"]
5
+ gem.email = "enrique@cloverinteractive.com"
6
+ gem.homepage = "http://github.com/EnriqueVidal/sexy_bookmarks"
7
+ gem.summary = "An easy to use rails port of sexybookmarks"
8
+
9
+ gem.description = "SexyBookmarks is only a rails port of wordpress popular plugin sexy bookmarks."
10
+
11
+ gem.files = Dir[ "lib/**/*.rb", "[A-Z]*", "init.rb", "sexy_bookmarks.gemspec", "lib/fixtures/*.yml", "lib/sexybookmarks/*/*/*/*" ]
12
+ gem.test_files = Dir[ "test/**/*" ]
13
+ gem.require_path = "lib"
14
+
15
+ gem.extra_rdoc_files = Dir[ "*.rdoc" ]
16
+ gem.rdoc_options = ["--charset=UTF-8", "--exclude=lib/sexy_bookmarks/assets"]
17
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class SexyBookmarksTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sexy_bookmarks
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Enrique Vidal
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-30 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: SexyBookmarks is only a rails port of wordpress popular plugin sexy bookmarks.
22
+ email: enrique@cloverinteractive.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.rdoc
29
+ files:
30
+ - lib/sexy_bookmarks.rb
31
+ - lib/sexy_bookmarks_macros_helper.rb
32
+ - README.rdoc
33
+ - init.rb
34
+ - sexy_bookmarks.gemspec
35
+ - lib/fixtures/socials.yml
36
+ - lib/sexybookmarks/assets/images/sexybookmarks/custom-fugue-sprite.png
37
+ - lib/sexybookmarks/assets/images/sexybookmarks/error-delete.jpg
38
+ - lib/sexybookmarks/assets/images/sexybookmarks/flo-head.jpg
39
+ - lib/sexybookmarks/assets/images/sexybookmarks/green-grad.png
40
+ - lib/sexybookmarks/assets/images/sexybookmarks/information-delete.jpg
41
+ - lib/sexybookmarks/assets/images/sexybookmarks/red-grad.png
42
+ - lib/sexybookmarks/assets/images/sexybookmarks/share-enjoy.png
43
+ - lib/sexybookmarks/assets/images/sexybookmarks/share-german.png
44
+ - lib/sexybookmarks/assets/images/sexybookmarks/share-knowledge.png
45
+ - lib/sexybookmarks/assets/images/sexybookmarks/share-love-hearts.png
46
+ - lib/sexybookmarks/assets/images/sexybookmarks/share-wealth.png
47
+ - lib/sexybookmarks/assets/images/sexybookmarks/shareaholic-220.png
48
+ - lib/sexybookmarks/assets/images/sexybookmarks/sharing-caring-hearts.png
49
+ - lib/sexybookmarks/assets/images/sexybookmarks/sharing-caring.png
50
+ - lib/sexybookmarks/assets/images/sexybookmarks/sharing-shr.png
51
+ - lib/sexybookmarks/assets/images/sexybookmarks/shr-sprite.png
52
+ - lib/sexybookmarks/assets/images/sexybookmarks/shrsb-logo.png
53
+ - lib/sexybookmarks/assets/images/sexybookmarks/success-delete.jpg
54
+ - lib/sexybookmarks/assets/images/sexybookmarks/warning-big.png
55
+ - lib/sexybookmarks/assets/images/sexybookmarks/warning-delete.jpg
56
+ - lib/sexybookmarks/assets/images/sexybookmarks/white-pix.jpg
57
+ - lib/sexybookmarks/assets/stylesheets/sexybookmarks/style.css
58
+ - test/sexy_bookmarks_test.rb
59
+ - test/test_helper.rb
60
+ has_rdoc: true
61
+ homepage: http://github.com/EnriqueVidal/sexy_bookmarks
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --charset=UTF-8
67
+ - --exclude=lib/sexy_bookmarks/assets
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.3.7
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: An easy to use rails port of sexybookmarks
95
+ test_files:
96
+ - test/sexy_bookmarks_test.rb
97
+ - test/test_helper.rb