Using RJS templates

Par défaut

Ruby on Rails is a great platform to work with, there is so much niceties for geeks like me. Today has been a great day to work with RJS templates.
You must use RJS templates, just because when you don’t know where to put the view behavior after an action, and because filling a link_to_remote helper with too much parameters is really ugly.

Changing DOM className

Because my application needs to display some dynamic user selection of an avatar, a great way has been to change the CSS className of the selected avatar.
Here is how to do it with RJS:

page.select(".avatar").all() do |element, index|
  page.call 'Element.removeClassName', element, 'selected_avatar'
end

page.call 'Element.addClassName', @avatar, 'selected_avatar'

Saving time

Par défaut

I believe one of the purpose of any creation if saving Humanity time, just to have more time to create new tools.

Today, I’ve discovered a tool that will save few hours of my life, just to build HTML/CSS grid layouts. Simple, elegant:

http://blog.davglass.com/files/yui/grids/

YUI is a nice « 2007 tech » challenger. Enough of all these homemade hack to have a Javascript working on IE-Firefox-Safari. 2006 was the year of Web 2.0 JS packages like Script.aculo.us, moo.fx or Lightbox, let’s see what will happen in 2007.