What's a smart way....

To do the following...

Suppose I have a list of links in a div of my main template, application.html.erb.

One of those links, the "administrator" link, needs to be able to change all the other links, so that a new set of links displays (with a "Back to application" link therein, to set the links back to the original way)

I'm trying to figure out a sane and simple way to do this (I am concocting lots of bad ways to do it!) Please help.

My application.html.erb appears here as:

       <div id="navcontainer">          <%= links_for_navigation %>           <div id="Body" >             <%= yield %>           </div>         </div>

and then, in my applicationhelper file, I create the links themselves. How would you tackle this in an intelligent manner? I am making a mess of my code trying to do this. -Janna

Make "administrator" a link_to_remote and use :update:

link_to_remote "Administrator", :update => 'Body' :url => { :action => ...

But I want to only change the menu bar on that. This doesnt do that.

Thank you! Yes, it is the same menu, I am simply trying to replace it. I dont care what else is on the screen, I just want to flip the menu. I am getting hung up on the syntax here though, I have:

link_to_remote( 'Admin', :update => 'links_for_navigation' ,nil )

the specific div where the menu(s) occur are in a div called 'links_for_navigation' - but the syntax here of link_to_remote, when all I want to do is change what is in an individual dic in the application template, I am unable to discern -- the rest of the page should merely remain the same.

Also, even if I can get the syntax right on this here, how do you set some kind of variable (session fariable perhaps?) to know within the ApplicationHelper which of the two menus to display? -Janna, my helper follows....

module ApplicationHelper

   def nav_link_to(name, options, html_options)

      link_to name, options, html_options     end

    def links_for_navigation       tabs =       if #I need some value here to determine which menu to choose!

        tabs << link_to_remote( 'Admin', :update => 'links_for_navigation' ,nil )

        tabs << nav_link_to('Reports', {:controller => 'customers', :action => 'list'}, {:title => 'Go to Reports', :style => 'float: right;'})         tabs << nav_link_to('Customers', {:controller => 'customers', :action => 'list'}, {:title => 'Manage Customer', :style => 'float: right;'})         tabs << nav_link_to('Scheduler', {:controller => 'projects', :action => 'list'}, {:title => 'Go to Scheduler', :style => 'float: right;'})         tabs << nav_link_to('InOut', {:controller => 'associates', :action => 'list'}, {:title => 'In Out Board', :style => 'float: right;')         tabs << nav_link_to('Uplog', {:controller => 'customers', :action => 'list'}, {:title => 'Access Uplog', :style => 'float: right;'})       else

  tabs << link_to_remote( 'Back to Application', :update => 'links_for_navigation' ,nil )

        tabs << nav_link_to('Reasons', {:controller => 'reasons', :action => 'list'}, {:title => 'Reasons', :style => 'float: right;'})         tabs << nav_link_to('Selections', {:controller => 'selections', :action => 'list'}, {:title => 'Selections', :style => 'float: right;'})         tabs << nav_link_to('Activities', {:controller => 'activities', :action => 'list'}, {:title => 'Activities', :style => 'float: right;'})         tabs << nav_link_to('ActivityTypes', {:controller => 'activitytypes', :action => 'list'}, {:title => 'Activity Types', :style => 'float: right;'})         tabs << nav_link_to('Status', {:controller => 'status', :action => 'list'}, {:title => 'Status', :style => 'float: right;'})         tabs << nav_link_to('Origins', {:controller => 'origins', :action => 'list'}, {:title => 'Origins', :style => 'float: right;'})         tabs << nav_link_to('Associates', {:controller => 'associates', :action => 'list'}, {:title => 'Associates', :style => 'float: right;'})       end       html = '<ul id="navlist">'       tabs.each do |tab|         html += '<li>'         html += tab         html += '</li>'       end     end

end