Forum: Ruby on Rails How to make an OSX Finder in rails/AJAX?

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.
Ab4c5cd5d9cc028fcba7a5eec8e1bf30?d=identicon&s=25 Mantat (Guest)
on 2006-06-08 22:15
I need to make a category browser that would allow nested categories. Is
there any receipe on that?

Currently, I use the :onchange event from one of the form element to
update the first select (out of 4-5 selects), but I dont know how to
elegantly reset all the child selects if I change the value from the
first.

All the categories are fetched from the DB and I would like a 'generic'
solution to this. My current solution involves too much coupling between
the Controller and the view and thats a Bad Thing (tm).

Anyone can help with this?
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-06-08 23:34
(Received via mailing list)
Google for acts_as_tree and livetree.

I think the pair is what you're looking for.

--
-- Tom Mornini
Ab4c5cd5d9cc028fcba7a5eec8e1bf30?d=identicon&s=25 Mantat (Guest)
on 2006-06-09 04:53
Tom, you saved me days of troubles!!! Thanks a lot!

I was already using the act_as_tree but my googling never poped the
livetree site.

You have no idea how happy I am! even tho I learned a lot trying to
emulate that thing, I am happy to find something already tested and
complete!

Ye!!!
Ab4c5cd5d9cc028fcba7a5eec8e1bf30?d=identicon&s=25 Mantat (Guest)
on 2006-06-09 05:01
Crap.. .I feel stupid to reply to myself after my previous post but...

I talked too fast! I look at the specs, everything was fine until I
looked at the screenshots.

The finder offered by livetree is more like the file explorer of
windows. The Finder on the mac that I was talking about is the one that
display each 'level' in a column. So let say we have 3 columns, when you
click on a value in the first column, it fetch the data from the DB then
populate the second column. Then, when you pick a value from the second
column, it will update the third.

The problem is if at that time I click on the first column, it needs to
clear the thrid column and update the second...

I have a solution in my head to do this but it involves a lot of
javascript and too much coupling between the controller and the view....

So still looking...
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-06-09 06:42
(Received via mailing list)
On Jun 8, 2006, at 8:01 PM, Mantat wrote:

> click on a value in the first column, it fetch the data from the DB
> then
> populate the second column. Then, when you pick a value from the
> second
> column, it will update the third.

Oh, THAT OS X Finder view!

There are 3 of them, after all. :-)

Sorry for the misinformation.

--
-- Tom Mornini
Af72b502d277ea86637ba12c5056ec68?d=identicon&s=25 unknown (Guest)
on 2006-06-09 09:11
(Received via mailing list)
these people seem to do a convincing rendition of the finder's column
view
=)
    http://www.apple.com/downloads/dashboard/
Ab4c5cd5d9cc028fcba7a5eec8e1bf30?d=identicon&s=25 Mantat (Guest)
on 2006-06-09 13:24
unknown wrote:
> these people seem to do a convincing rendition of the finder's column
> view
> =)
>     http://www.apple.com/downloads/dashboard/

Actually, they dont.. the column no 3 doesnt clear when you change the
selected item form colum 1...

This is really not as easy as I fight thought!!! I will keep you
informed of my progress...
30ee518e6fdc5b07e060775b5a542bdb?d=identicon&s=25 Jón Borgþórsson (jongretar)
on 2006-06-09 13:34
(Received via mailing list)
Ajax and partials should help you there.

apple.com does this with this structure

<div id="col_1"></div><div id="col_2"></div><div id="col_3"></div>
Thus. It only updates col_2 when something is selected in col_1.
However. You could organize this like so:
<div id="col_1"><div id="col_2"><div id="col_3"></div></div></div>

That way. When you do an ajax call to change col_2 it automatically
removes col_3. You just have to include <div id="col_3"></div> at the
end of your col_2 partial.

On 6/9/06, Mantat <mantat@videotron.ca> wrote:
> informed of my progress...
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
This topic is locked and can not be replied to.