Jesse B. wrote in post #1009493:
Hello, I have been trying to find a solution to this for some time. What
I am trying to do is to have a parent form that can “reassign” child
objects previously assigned to other parent objects.
Here’s a use case: say you had an app for a grocery list. aisles are the
parent and items are the child. An aisle has_many items, an item
belongs_to an aisle.
You had previously assigned cilantro as being in aisle 5, but then you
discover it’s in aisle 3, not aisle 5.
You are on the edit page for aisle 3 and want to be able to reassign
cilantro to it in one action from there, rather than leaving the aisle
three form, and navigating to the cilantro form and changing the parent.
It seems inefficient to make the user do all this navigation in the
first place. Yes, I get that having an edit page per aisle would be what
you got from a scaffolding style application, but from a user
perspective that’s nuts.
Just from my quick thought experiment I would build a UI that listed all
aisles on a single page. Each
aisle would be represented by a column on the page listing the items
contained within that aisle. The user would then organize their items in
the store by dragging them from one aisle to another. Each aisle column
might have an add button that performs a search for adding new items to
that aisle.
±-----------±-----------±-----------+
| Aisle 1 | Aisle 2 | Aisle 3 |
±-----------±-----------±-----------+
| Cilantro | Eggs | |
| | Milk | |
| | | |
±-----------±-----------±-----------+
| [Add] | [Add] | [Add] |
±-----------±-----------±-----------+
=> Drag Cilantro from Aisle 1 to Aisle 3
±-----------±-----------±-----------+
| Aisle 1 | Aisle 2 | Aisle 3 |
±-----------±-----------±-----------+
| | Eggs | Cilantro |
| | Milk | |
| | | |
±-----------±-----------±-----------+
| [Add] | [Add] | [Add] |
±-----------±-----------±-----------+
At this point you might ask, “Isn’t this a lot more work on the part of
the developer?” Well, sure it is. But, as a user this is the sort of
functionality that I would expect when presented with the task of
organizing items into aisles. There are a number of client-side tools
that would make building something like this, not only doable, but not
nearly as difficult as it might seem at first glance. There are
drag-and-drop objects in jQuery that would help with this sort of
interface.