I’m writing a simple CMS where every item (“listing”) HABTM categories
and subcategories (which themselves belong_to a category). What I’m
trying to do now is create a UI effect for listing creation: when you go
to create a listing, only the possible categories will be shown, but
when you select a category a set of new categories will be displayed
like so:
Lions
Tigers
Bears
click on Tigers
Lions
Tigers
Feeding
Breeding
Storing
Bears
de-select Tigers and it returns to normal.
What I have right now is a display where every category and subcategory
is displayed at once. The code looks something like this:
<% for category in @categories %>
Is there some kind of conditional I can put before the second “for”
statement? An is_checked? sort of thing? Or maybe AJAX using
Element.toggle? I don’t know where to start - and a web search didn’t do
much good.
Thanks,
Adam