How can I make highlights_on behavior dynamic on Tabnav?

3 views
Skip to first unread message

sSs

unread,
Mar 8, 2010, 3:13:22 PM3/8/10
to Rails Widgets Dev
Hello,
I just started adopting Tabnav plugin, but I don't understand how the
hightlights_on parameter can change it's value dynamically after the
tabs are build on my page at the beginning (the first time the rails
page is rendererd/loaded). After the tabs are build the highlights_on
parameter is not affected at all.

I have two tabs displaying as intended using some Ajax, however I
can't make the behavior dynamic so that when I click on my second tab
"Calendar" I would see the active tab to be the "Calendar" and not the
"Photos" tab. In my case, the "Photos" tab stays active even though
the data is loaded for my "Calendar" tab. I want the controller name
and action name to dictate which tab should be displayed as active.

This is what I use in my _main_tab_nav.html.erb:

---------------------------------------------code
begins-------------------------------------------

add_tab do |t|
t.named "My Photos"
t.titled "See my photos!"
t.links_to_remote :update=>"main_tabnav_content", :url =>
show_photos_user_path(@user)
t.highlights_on :controller => "users"
end

add_tab do |t|
t.named 'Calendar'
t.titled "See my calendar!"
t.links_to_remote :update=> "main_tabnav_content", :url =>
show_event_calendar_user_path(@user)
t.highlights_on :controller => "users", :action =>
"show_event_calendar"
end

-----------------------end code---------------------

I tried figuring out the issue from the following resources but I seem
to be missing something:

http://groups.google.com/group/rails-widgets-dev/browse_thread/thread/3f3be9facd2670c2/40d020178d65954e?lnk=gst&q=links_to#40d020178d65954e

http://wiki.github.com/paolodona/rails-widgets/tabnav

Please help!

Thanks,
SS

Michele Franzin

unread,
Mar 10, 2010, 4:22:40 AM3/10/10
to rails-wi...@googlegroups.com
On Mon, Mar 8, 2010 at 9:13 PM, sSs <localerot...@gmail.com> wrote:
> Hello,
> I just started adopting Tabnav plugin, but I don't understand how the
> hightlights_on parameter can change it's value dynamically after the
> tabs are build on my page at the beginning (the first time the rails
> page is rendererd/loaded). After the tabs are build the highlights_on
> parameter is not affected at all.

have you tried to add the action param in the highlights_on of first tab?

> --
> You received this message because you are subscribed to the Google Groups "Rails Widgets Dev" group.
> To post to this group, send email to rails-wi...@googlegroups.com.
> To unsubscribe from this group, send email to rails-widgets-...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-widgets-dev?hl=en.
>
>

sSs

unread,
Mar 18, 2010, 3:42:42 PM3/18/10
to Rails Widgets Dev
yes, i did try adding the action param there too...do you have a code
snippet that I can take a look
rather than the examples provided on the official site?

SS

On Mar 10, 3:22 am, Michele Franzin <michele.fran...@gmail.com> wrote:

> >http://groups.google.com/group/rails-widgets-dev/browse_thread/thread...

Michele Franzin

unread,
Apr 26, 2010, 2:06:52 AM4/26/10
to rails-wi...@googlegroups.com
make a demo app reproducing the error; I'll take a look.
Reply all
Reply to author
Forward
0 new messages