Tabnav retires, enter Widgets!
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.




Great plugin!
Can you clarify how the highlighting and custom html features can be used? I dug around in the code to determine that I can do this:
add_tab do |t| ... t.html= { :id => ‘tab_home’ } end
to get id=”tab_home” on my Home tab. However, this is not really documented (unless I missed it), so there may be more to it.
Also, what is the best way to get the highlighting to work? It seems to work “automatically” in some cases, but in others (i.e. clicking from tab to tab on the page) it will not accurately highlight any tab, or will highlight the wrong one. I’ve let the highlighting work by itself, and also tried manual highlighting using “highlights_on” as defined in the module Widgets::Highlightable.
I’m assuming this is due to a mistake I’ve made, but I’m wondering if you could clarify the usage in the docs so I can see what I did wrong?
Thanks! -dave
Ok pulled in the “widgets” Now my app is dieying. Is there a new “rhtml” tag needed?
ActionView::ActionViewError in Account#login Showing app/views/layouts/login.rhtml where line #9 raised:
No rhtml, rxml, rjs or delegate template found for widgets/_login_tabnav in ./script/../config/../app/views
Extracted source (around line #9):
6: 7: 8: 9: <%= start_tabnav :login %> 10: 11: <%= @content_for_layout %> 12:
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:399:in `find_template_extension_for’ c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:335:in `pick_template_extension’ c:/ruby/lib/ruby/gems/1.8/gems/ Show session dump
- :return_to: / flash: !map:ActionController::Flash::FlashHash {}
Response Headers: {“Status”=>”200 OK”, “cookie”=>[], “Cache-Control”=>”no-cache”}
I just found the (old) tabnav plugin a few days ago. I thought it was great, but had a few minor aesthetic flaws. For example, I didn’t like the main_tabnav.rb file living in my models directory, since it wasn’t really a model like the others.
Just today I found the (new) widgets plugin. You are right, it is much more Ruby-esque. Good job. I got it working in only a few minutes.
I read your blog and like how you implemented the ‘if’ functionality.
Thanks for sharing this with the community.
I just switched from the old tabnav to the new one and I really like it.
I has just one problem. When no tab is selected I would like to display just the tabs without any main_tabnav_content. In my application two empty rows of content are displayed below the tabs. How to get rid of that ?
Hans, do you mean a boxed tabnav? you can pass tabnav method a block it will render a box with content underneath tabs, otherwise it will not.
So just try with
<%= tabnav :main %>instead of<% tabnav :main do ... end%>.are there examples of this?
Greate UI plugin! go on good job.
how can i have a tab wrapped in a custom css div (with inner spans – for image rounded corners and so forth).