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
On Jun 2, 11:51 am, Mk 27
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> JannaB wrote:
> > But I want to only change the menu bar on that. This doesnt do that.
>
> Okay, the specifics of your app are not clear to me. If you place your
> menu bar in a div (sorry, I guess that div was not "Body"), then
you can
> swap the contents of the menu bar the same way.
>
> For example, if you have one horizontal menu bar with three items that
> all have a drop down or sub-menu attached, you can actually use just
> *one* drop down (or a box containing the active sub-menu). To change
> the contents of the active sub-menu (or drop-down), you use
> link_to_remote with all the menu bar options, :update''ing the div
> containing the sub-menu.
>
> Those links don''t have to be in a separate menu (this I think is
closer
> to what you are doing); they could be in the same menu. So when you
> click on the "administrator" option, the :update refers to the
*same*
> div that contains the menu with the administrator option. Then the
> entire menu is replaced, and you have a "back to main menu"
option which
> works the same way. Get it?
> --
> Posted viahttp://www.ruby-forum.com/.