A while back I wrote BookmarkIt! , a social bookmarllet plugin for Typo, and it worked for a while, but the Typo plugin API changed, and changed again, and again, and keeping up was no fun. So since then, I’ve already changed my approach for my TextLinkAds plugin and instead wrote a bona fide rails plugin, and since Typo 4.0.3 broke the plugin one more time, it was time to take the same route.
Morevover, the previous version did not allow for putting the Bookmkarlets inline with the post and this new version addresses that also. It is now a real Rails plugin, useable in any Rails app.
How to Get the plugin
script/plugin install http://svn.nanorails.com/plugins/bookmarkit/
or to use svn:externals to get updates
script/plugin install -x http://svn.nanorails.com/plugins/bookmarkit/
The install will automatically copy the config file, the images, the css and the partial in their final location. If you delete these files, you can reinstall with:
script/plugin install --force http://svn.nanorails.com/plugins/bookmarkit/
How to configure the plugin
To configure, edit the file config/bookmarkit.yml to change the title and select which bookmarklets you want displayed.
title: Bookmark It! delicious: true(default)/false digg: true(default)/false reddit: true(default)/false blinklist: true(default)/false dzone: true(default)/false newsvine: true(default)/false furl: true(default)/false spurl: true(default)/false simpy: true(default)/false fark: true(default)/false blogmarks: true(default)/false myweb2: true(default)/false wists: true(default)/false
How to use the plugin
To use, inside any view (.rhtml), use:
<%= render_BMI(title, url) %>
For example, in Typo, you would include the following in app/views/articles/read.rhtml
<%= render_BMI(@article.title, @article.location) %>
For finer control of the rendering, it also copies a css (bookmarkit.css) to public/stylesheets. To use, include in your main layout with:
<%= stylesheet_link_tag "/stylesheets/bookmarkit" %>
Adding more bookmarklets
All the bookmarklet html is in the _bookmarkit.rhtml partial.
For example, for BlinkList, I’ve used:
<a style="font-size:22px;" title="Blink '<%= title %>'" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=<%= url %>&Title=<%= title %>"> <img style="border:0;" hspace="3" class="bookrmarkit" alt="Blink" title="Blink '<%= title %>'" src="/images/bookmarkit/blinklist.gif" /> </a>
You should also add an entry in bookmarkit.yml
If you want more bookmakrlets included, submit your patches in the comments or send to psq_at_no_spam_nanorails_dot_no_spam_com.