in html/css, Rails

Bookmark It! Rails plugin for adding bookmarklets.

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

or to use svn:externals to get updates

script/plugin install -x

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

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="<%= url %>&Title=<%= title %>">
            <img style="border:0;" hspace="3" class="bookrmarkit" alt="Blink" title="Blink '<%= title %>'" src="/images/bookmarkit/blinklist.gif" />

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.

  1. I’d just like to thank you for the great little plugin! I am a rails newbie and am still learning the ropes. I had to update your config a bit, but it works beautifully otherwise.

  2. There is a little bug in installation script.
    It copies _bookmarkit.html partial to ‘app/views/shared’ file not a folder. At least on win xp.

  3. I installed the bookmarkit plug-in. Its giving the error

    ” undefined method `render_BMI’”
    can you help it for this

    I am using rails 2.1

  4. @shs: I have not use this plugin in a while, and not with rails 2.1

    A quick review did not show anything helpful and it should work. Where is that method not being found, in a a view?

    Could it be that the helper method no longer takes a module and you would need to use #included, which would call the #helper and add render_BMI?

Comments are closed.