Tab highlighting and redirect_to

Hi
In the controller i have the code

def sd_resolution_save_from_search_sd_ticket
#Some code here
sd_resolution_save_common_function
redirect_to(:action => ‘show_details’, :id =>
params[:id],:activeTab => 1)
end

So the result is executing the show_details with highlighted second tab
(Did using a script .Tab in order 0,1,etc).
But the problem is (not big) now the address bar of the browser like

http://localhost:3000/service_desk/show_details/7?activeTab=1

So wgen ever i refresh the second tab highlighted.What I need is to
highlight the first tab.How?How can I redirect to make address bar of
browser like
http://localhost:3000/service_desk/show_details/7

Thanks in advance
Sijo

http://localhost:3000/service_desk/show_details/7?activeTab=1

How can I redirect to make address bar of
browser like
http://localhost:3000/service_desk/show_details/7

GO TO config/routes.rb and add this line :

ActionController::Routing::Routes.draw do |map|

map.active_tab ‘:controller/:action/:id’,
:controller=>‘service_desk’, :action=> ‘show_details’,
:requirements => { :activeTab => /\d+/},
:activeTab => nil

What do you think?

Enjoy,
Reinhart
http://teapoci.blogspot.com

Hi
Thanks for your reply.But first time I need second tab
highlighted.But after changing the routes.rb as you said it always
highlighting the first tab.What I need is browser look like

http://localhost:3000/service_desk/show_details/7 after execute
above fnction

rather than
http://localhost:3000/service_desk/show_details/7?activeTab=1

So then the tab second will be highlighted and when i press refresh the
first tab will.(My scrpt takes tab order as 0,1,etc. activeTab=1 is the
second tab)

Thanks
Sijo

So then the tab second will be highlighted and when i press refresh the
first tab will.(My scrpt takes tab order as 0,1,etc. activeTab=1 is the
second tab)

What do you mean that is, if you refresh browser the tab 0 & 1 will be
run together? if yes, it is in your controller not in routes.

def show_details

@all_details = []

for tab_id in 0…params[:activeTab].to_i
@all_details << AnyModel.find(tab_id)
end

end

sorry if I feel little bit ambiguous with your problem point.

Cheers,

Reinhart
http://teapoci.blogspot.com

Hi
I think you did not understand my problem.In short during
redirectiong in the function the activeTab param is visible in the
browser address bar…How can I remove that.
Is there any render :method => ‘post’ or
redirect_to :method => ‘post’
Like that

Regards
Sijo

Hi

I want to create a tab panel, but did not get how to create it. Would
you please help me…?
Please write basic code snippet.

Thanks in advance

Ekta
[email protected]

What about css?
I guess you have tabs something like amazon or every other web site.
When you click on an item to show you want to highlight a tab?
If so you could have a different layout for Show or programitclly give
the tab/list item an id.
Then in you CSS make it look highlighted.

Something like that?

John I

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs