The easiest way to add tabbed navigation to your Rails app!

Posted by Paolo Mon, 24 Jul 2006 01:09:00 GMT

UPDATE Feb 01, 2007: the Tabnav has been updated in order to work wit Rails 1.2, read this post fom more info.

Hi guys, during our development efforts we needed tabbed navigations. Well, after struggling with the acts_as_wizard plugin (you can find it in the toolbox) we decided to implement yet another rails plugin, and we think this time it’s even easier to use and someway plain cool.

Tabnav it’s so far the easiest way to build tabbed navigation like this:

A basic Tabnav...

The Tabnav Rails plugin provides nice tabbed navigation out of the box

All this magic it’s done by this fragment of code put inside my layout:

<%= start_tabnav :main %>
<%= @content_for_layout %>
<%= end_tabnav %>

Sounds cool? keep reading…

Socialize it: Add to del.icio.us Digg it! Technorati: The easiest way to add tabbed navigation to your Rails app! Add to reddit.com

Read more...

Posted in , ,  | Tags , , ,  | 107 comments | no trackbacks

acts_as_wizard refactored!

Posted by Paolo Tue, 18 Jul 2006 04:58:00 GMT

Our acts_as_wizard plugin needed improvements to address a few needs of an application we’re currently working on. I promised improvements to a bunch of early adopters too so finally I took my time and have done this dirty work.

If you don’t know acts_as_wizard yet, you just need to know it’s a rails plugin to help you build clean and simple web wizards.

You can find acts_as_wizard articles, installation instructions, tutorials and previous posts in the SeeSaw’s toolbox.

A Wizard can be simply defined this way:

class CreateCatAndDogWizard < Wizard::Base     
    add_step do 
      named 'Insert your cat'
      controlled_by :cats
      enable_actions :new, :create
      add_rewrite({:action => 'list'}, 
                  {:controller => 'dogs', :action => 'new'})
    end 

    add_step do
      named 'Insert your dog'
      controlled_by :dogs
      enable_actions :new, :create
      add_rewrite({:action => 'list'}, 
                  {:controller => 'main', :action => 'finished'})
    end 

    add_step do 
      named 'Finished!'
      controlled_by :main
      enable_actions :finished 
    end     
end

The main areas our refactoring focused on are:

  1. get rid of every controller contamination: we wanted controllers to be totally unaware of being part of a wizard.
  2. multi wizard support: the same controller must be able to take part of different wizards.
  3. general code cleanup: well, we just were ashamed of some dirty code..

If you’ve never uses acts_as_wizard, you don’t need to read what follows, just remember it has gotten better :)

If you were an early adopter instead, keep reading an I’ll show you what technically has changed…

Socialize it: Add to del.icio.us Digg it! Technorati: acts_as_wizard refactored! Add to reddit.com

Read more...

Posted in , ,  | Tags , , , ,  | 6 comments | no trackbacks


SeeSaw srl - Via Monte Pasubio, 8 37126 Verona - tel +39 045 4857457 fax 045 4851151 P.Iva 03609790237