Hi Railers, I have a model with many associations (20+). I would like to display the relative associations using AJAX, allowing the user to display the association his/her is interesting at a particular time. Is there any existing applications or sample code that I can look at to accomplish the task? Present I have one long page, with master (displaying current record information) and many details tables (html tables displaying related associations information). That sucks. I am thinking that it would be much better User Interface design if the user could click on a particular association listings and the info appears and dis-appears using the prototype JavaScript library. Thanks for any suggestions, Leon _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> Present I have one long page, with master (displaying current > record information) and many details tables (html tables displaying > related associations information). That sucks.Yes, it does. <grin>> I am thinking that it would be much better User Interface design if > the user could click on a particular association listings and the > info appears and dis-appears using the prototype JavaScript library.One possibility would be to use tabs. They''re easy to build in CSS; check out http://www.alistapart.com/articles/slidingdoors/ for an example. You then set up a <div> for your content, and replace its contents with the proper detail inspector using link_to_remote. A short example: <ul id="tabs"> <li><%= link_to_remote ''Invoices'', :url => { :action => ''invoices_with_ajax'', :id => my_id_value }, :update => ''content'' %></li> <li><%= link_to_remote ''Payments'', :url => { :action => ''payments_with_ajax'', :id => my_id_value }, :update => ''content'' %></li> </ul> <div id="content" /> When the links are pressed, the rendered results of your actions will be placed inside the content <div>. If you''re on Edge Rails, you can use RJS templates to make it even simpler, but that''s another question in itself. -Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20051230/87beee64/attachment.html
Ben, Thank you for you response, it sounds like this can work in my situation. I am going to attempt to have two set of tabs on each page with the inner tabs using AJAX. I am doing this because i already have outter typo-like main menu tabs. Leon. On 12/30/05, Benjamin Stiglitz <ben@tanjero.com> wrote:> > Present I have one long page, with master (displaying current record > information) and many details tables (html tables displaying related > associations information). That sucks. > > > Yes, it does. <grin> > > I am thinking that it would be much better User Interface design if the > user could click on a particular association listings and the info appears > and dis-appears using the prototype JavaScript library. > > > One possibility would be to use tabs. They''re easy to build in CSS; check > out http://www.alistapart.com/articles/slidingdoors/ for an example. You > then set up a <div> for your content, and replace its contents with the > proper detail inspector using link_to_remote. A short example: > > <ul id="tabs"> > <li><%= link_to_remote ''Invoices'', :url => { :action => > ''invoices_with_ajax'', :id => my_id_value }, :update => ''content'' %></li> > <li><%= link_to_remote ''Payments'', :url => { :action => > ''payments_with_ajax'', :id => my_id_value }, :update => ''content'' %></li> > </ul> > <div id="content" /> > > When the links are pressed, the rendered results of your actions will be > placed inside the content <div>. If you''re on Edge Rails, you can use RJS > templates to make it even simpler, but that''s another question in itself. > > -Ben > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- First they laugh at you, then they ignore you, then they fight you. Then you win. -- Mahatma Karamchand Gandhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20051231/43e036b2/attachment.html