Forum: Ruby on Rails Beauty in Page Layout

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2073c7e0e7d2311727b680a887a375be?d=identicon&s=25 Leon Leslie (Guest)
on 2005-12-30 22:39
(Received via mailing list)
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
B554bcde846e4497eeffffc1399d3b09?d=identicon&s=25 Benjamin Stiglitz (Guest)
on 2005-12-31 00:58
(Received via mailing list)
> 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
2073c7e0e7d2311727b680a887a375be?d=identicon&s=25 Leon Leslie (Guest)
on 2005-12-31 13:33
(Received via mailing list)
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.
This topic is locked and can not be replied to.