My application is used by parents and their children.
I should like to allow a parent to edit details about their children from their account page. I envisage a single form where the upper section contains fields about the parent and the lower section contains fields about a child. If a parent has more than one child, the lower section will be tabbed; one tab per child.
I'd like to achieve a RESTful design if possible. The options I've considered so far are:
Option 1 - Expose the parent and all children (list of nested child forms) via the parent's resource route and then use JavaScript to change the UI into a tab-based layout.
Option 2 - Expose the parent and one child (nested form) via the parent's resource route. Expose the same page but for a specific child via nested routes.
So:
'GET /parent/1' will render the account page of the parent with a nested sub-form for the 'first' (default) child. It will also contain two or more clickable links (styled as tabs) which link to nested routes; one for each child (e.g. 'GET /account/1/child/1' and 'GET /account/1/child/2').
Each nested route will be serviced by a 'kids' controller which will in effect render the exact same parent's account page as would be rendered by the parent route/controller but with the appropriately populated sub-form for the child resource addressed by the route.
Option 2 would seem to be a feasible approach but I would welcome feedback, and any other ideas.