One Year of Rails, on_idle plugin

I’ve been using Rails for about a year, and I am, in general, quite satisfied. It really is a big step forward in terms of web programming, and I’ve found the whole experience very enjoyable. In a year I’ve managed to crank out a number of sites in my spare time (in between various other activities such as the occasional bike ride and Hecl hacking):

  • linuxsi.com – a site in Italian helping people to locate Linux-friendly computer retailers.

  • builder.hecl.org – lets you create Hecl mobile phone applications from your web browser.

  • libreriaminerva.it – a small bookstore in the center of Padova, specializing in rare and antique books and prints.

  • stufftodo.dedasys.com – my own vision of an ajaxy todo list that plays nicely in a business environment, where it’s important to be able to share tasks.

As promised, one of my goals is to shift a bit towards producing open source software as a side effect of revenue generating work. The first small result of that is the on_idle plugin I packaged up for Rails. It’s the code that Stuff To Do uses to tell whether people are active or not. Installing it should be as simple as:

./script/plugin install http://svn.dedasys.com/public/on_idle

It’s just a few lines of Javascript code that are wrapped up in a way that makes it trivial to use from Rails views:

def on_idle(timeout, options, wakeoptions)

<%= on_idle(600, {:url => { :action => 'notify_idle' }},
                 {:url => { :action => 'notify_wake' }}) %>
  • timeout: the number of seconds before the user is considered ‘timed
    out’.

  • options: the action to perform when the user goes idle.

  • wakeoptions: what to do when the user ‘wakes up’.

Let me know if there is anything I should fix/change/improve. If this plugin works out, I will post, in short order, a plugin that improves the default Rails drag and drop functionality.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s