Posted by Paolo
Mon, 25 Feb 2008 16:26:00 GMT

The Rails Widgets plugin is our most successful open-source effort so far. Lately its development has been put a bit aside and hasn’t got the love it surely deserve. This is mainly because this little piece of software is pretty stable and just suits our needs.
But of course it could be improved, more widgets could be added and the code could be refactored. Why should our own needs stop its development? There are many people on the Widgets Users Mailing List who come up with great ideas about its development so we finally decided to open up the repo and let this plugin find its way through the community!
The repo is now officially hosted on Google Code at http://code.google.com/p/rails-widgets and a brand new Developers Mailing List has been set up to coordinate the development efforts.
We’re willing to find new committers who share our vision about the plugin and help us take it to the next level, so if you’re interested, feel free to join us!
Hope you enjoy it!
Socialize it:
Posted in Ruby + Rails | Tags tabnav, widgets | 1 comment | no trackbacks
Posted by Paolo
Mon, 03 Sep 2007 14:14:00 GMT
Hi guys, I just gotten back from my one-week vacation in Egypt and imagine what I found on my email inbox? Wow… a bunch of people are giving us feedback on the new Tabnav widget just a few days after its public release.
So let’s dig some changes between the old version and the new one:
Tabnav didn’t highlight with URLs beginning with a slash
Let’s consider this scenario:
add_tab do |t|
t.named 'Cat'
t.links_to :controller => '/cats'
end
This didn’t correctly highlight on :controller => 'cats' beacuse of the leading slash of the controller parameter. Now thanks to Cédric Deltheil this issue as been solved. I’ve never experienced this problem myself… It’s difficult to fix something if you don’t know it’s broken :-) (Cédric pointed me to an old Peter Salomon comment rearding this issue. I didn’t get notified about that comment… so I apologize. I start hating typo, I promise we’ll move to a new blogging system soon).
Where’s my beloved show_if method?
show_if was a very useful method in the old Tabnav. You could set a condition to show or hide specific tabs (eg Administration tabs). Well, we got rid of that.
With the new Widgets version the Tabnav definition is backed up by a partial, no more a specific model. That allows us to use pure ruby conditional code to add tabs whenever we want to. And that’s just because the tabnav definition gets reevaluated for every request.
One example is better that a thousand words: look at the if modifier at the end of the 2nd tab:
<%
render_tabnav :main, :generate_css => true do
add_tab do |t|
t.named 'Home'
t.links_to :controller => 'home'
end
add_tab do |t|
t.named 'Users'
t.links_to :controller => 'users'
end if current_user.admin?
end
%>
You can also enclose one or more add_tab inside a if/unless block like this:
if @admin
add_tab do |t|
t.named 'Users'
t.links_to :controller => 'users'
end
add_tab do |t|
t.named 'Customers'
t.links_to :controller => 'customers'
end
end
It’s clear now that the show_if method wasn’t really necessary and was difficult to use because of the procs. Now you can just use your view’s params/variables/helpers as conditions.
True dynamic tabs
The facts that Tabnav is now a helper leads to another big improvement. You can now have true dynamic tabs. The default generated Tabnav now generates something like this:
render_tabnav :main,
:generate_css => true do
controller_names.each do |name|
add_tab do |t|
t.named name.camelize
t.titled "Go to #{name.camelize}"
t.links_to :controller => name
end
end
end
What does that mean? It dynamically generates a tab for every controller, just like the scaffold does with column names! Of course you’ve got to customize that, but it shows the power that this version brings to you.
You can now have a tab for every user like 37signals’s Highrise does! Just imagine something like this:
render_tabnav :contacts,
:generate_css => true do
@contacts.each do |contact|
add_tab do |t|
t.named contact.name
t.links_to :controller => 'contacts', :action => 'show', :id => contact.id
end
end
end
No more start/end
Another little improvement: Tabnav’s content are now specified as a block.
<%= start_tabnav :main %>
...
<%= end_tabnav %>
#new widget version
<% tabnav :main do %>
...
<% end %>
It’s just a lot more Rubysh now…
Hope you enjoy the improvements. If you experience issues just drop us a line.
A big thank you to Cédric Deltheil, Mark Swinson, Denis Bruléand and Glenn West for their feedback!
Socialize it:
Posted in Ruby + Rails | Tags plugin, Ruby On Rails, tabnav, widgets | 5 comments | no trackbacks
Posted by Paolo
Sat, 18 Aug 2007 23:44:00 GMT
03 sep 07 UPDATE: see a few changes we’ve made to the new version reading this post!
Hi guys, I’m working on my RailsConfEurope presentation during these days. I decided to fix a few Tabnav issues and write a few more components we often use.
I ended up writing a new Rails plugin named Widgets. It aims to offer a consistent set of rails helpers which can help you insert nice components in your rails app with no effort at all.
It already contains a more flexible version of the Tabnav and a new Navigation widget (it allows you to define those little links you usually find in the top-right corner of webapps with the same powerful highlighting engine of the Tabnav).
I’m going to add more widgets before my speech in Berlin, so don’t consider this plugin as final. I’d like you to try this out and give me feedback…
just run:
ruby script/plugin install svn://svn.seesaw.it/widgets/trunk
and then run the tabnav generator:
ruby script/generate tabnav
or the navigation one…
ruby script/generate navigation
They should give you all the info you need to get started by yourself. Please send us feedback via email at staff@seesaw.it. We’re currently experiencing issues with the comment spam system, I promise we’ll fix it asap!
Thanks for reading.
Socialize it:
Posted in Ruby + Rails | Tags plugin, Ruby On Rails, railsconfeurope, tabnav, widgets | 8 comments | no trackbacks
Posted by Paolo
Mon, 18 Jun 2007 14:41:00 GMT

Hi guys,
I’m very proud to announce our Tabnav talk has been accepted for the RailsConf Europe! I’ll probably be speaking on Tuesday 18 as stated in this sessions panel.
I’ll get this chance to refactor our beloved plugin a bit and introduce a few juicy features.
I’m sure we’ll have a lot of fun… it seems many italian rubysts are attending the event too.
See you there then, and wish me good luck!
Socialize it:
Posted in Ruby + Rails | Tags dona, europe, paolo, railsconf, ruby, speech, tabnav, talk | no comments | no trackbacks
Posted by Paolo
Fri, 20 Apr 2007 02:35:00 GMT
Here’s the video of my speech at LRUG, and the discussion about REST.
Thanks to skillsmatter for making it available in such a short time.
Enjoy it! Suggestions and comments are always appreciated as usual…
Socialize it:
Posted in Ruby + Rails | Tags lrug, Ruby On Rails, ruby, speech, tabnav | 2 comments | no trackbacks
Posted by Paolo
Thu, 29 Mar 2007 14:08:00 GMT
Hey guys, sorry if we’ve been away for a while… I cannot hide we’re pretty busy right now, but thanks to Eric we’ve found and solved a bug in our beloved Tabnav.
In production environment tabs remained highlighted after clicking them, leading to a full highlighted tabnav after a couple of clicks… that’s actually my fault. I did use clone while tabs are evaluated in the page context… but clone didn’t clone the inner state of the tab..
We needed to add a Kernel#deep_clone method to solve the issue. I borrowed that method fro ruby-facets, so it’s should be pretty reliable.
Sorry for that guys, It’s only my my my my fault.
Just update your tabnav end everything will work.
Paolo
Socialize it:
Posted in Ruby + Rails | Tags tabnav | no comments | no trackbacks