It is possible have dynamic menu''s in my views? for example, in the following menu code: <div id="menu"> <ul> <li><a href="#" title="Link 1"><span>A</span></a></li> <li><a href="#" title="Link 2"><span>B</span></a></li> I would like to be able to have ruby populate the href and title from an array. Something like: <li><a href="<%= @href[1]%>" title="<%= @title[1]%>"><span>A</span>... <li><a href="<%= @href[2]%>" title="<%= @title[2]%>"><span>B</span>... i can add the loop to generate the number of menu''s. has anybody done this? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
that''s easy to do in RoR maybe put the menu-info in an array of hashes like {:href => "...", :title => "..."} named my_menu <ul> <% my_menu.each do |entry| %> <li><a href="<%= entry[:href]%>" title="<%= entry[:title]%>"><span>A</span> <% end %> </ul> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gemblon (t.b.) said the following on 19/12/07 10:22 AM:> It is possible have dynamic menu''s in my views? > > for example, in the following menu code: > > <div id="menu"> > <ul> > <li><a href="#" title="Link 1"><span>A</span></a></li> > <li><a href="#" title="Link 2"><span>B</span></a></li> > > I would like to be able to have ruby populate the href and title from an > array. > Something like: > > <li><a href="<%= @href[1]%>" title="<%= @title[1]%>"><span>A</span>... > <li><a href="<%= @href[2]%>" title="<%= @title[2]%>"><span>B</span>... > > i can add the loop to generate the number of menu''s. > > has anybody done this?See Tabnav Presentation at http://rails-widgets.googlegroups.com/web/rails-widgets-by-paolo-dona-at-railstoitaly-1193755397633919-4.pdf?gda=iUGBB3MAAADb_C9p6lwGsSLQNhI574fnNIwcRGMoSRrwpWzU9i2Ob2G1qiJ7UbTIup-M2XPURDQIpv1h7sibZLIapAuXd7Eg2CpAaV13DJbYJizNBsaZtd78gbToY9QXWVXc5zZBP3wAY6FChiKhqEwrEf-plYaiK4YoAX3ERE0DC1UD-MzSMQ Install: ruby script/plugin install svn://svn.seesaw.it/widgets/trunk -- "Politics is the art of appearing candid and completely open, while concealing as much as possible." -- Brian Herbert, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> that''s easy to do in RoR > > maybe put the menu-info in an array of hashes like {:href => "...", > :title => "..."} named my_menu > > <ul> > <% my_menu.each do |entry| %> > <li><a href="<%= entry[:href]%>" title="<%= > entry[:title]%>"><span>A</span> > <% end %> > </ul>thanks. worked great. used the array of hashes. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---