Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of multiple groups of the same structure #8

Closed
andrba opened this issue Dec 24, 2014 · 1 comment
Closed

Generation of multiple groups of the same structure #8

andrba opened this issue Dec 24, 2014 · 1 comment

Comments

@andrba
Copy link
Owner

andrba commented Dec 24, 2014

Sometimes it is necessary to create multiple groups of the same type. Imagine we have a form that asks about the addresses a person lived at within 10 years. Each address should consist of the following fields:

text_field :line_1
text_field :line_2
text_field :city
text_field country

Rather than copy-pasting 10..20 groups in the form definition we could set a quantity: 10 or multiple: true parameter which will render these groups automatically. Each group will have its number in the name, like page_mygroup_1 with field names like page_mygroup_1_city.

The question is how it will be rendered in the Rails app. Obviously we should not show to a user 10 groups all at once. I see two ways of doing it:

  1. Controlling dropdown
    Link group visibility to a dropdown with numbers 0..10. When a user selects the quantity of groups the corresponding amount of groups become visible.
  2. Add more / Delete buttons
    A group is rendered as a template that will be used by js to generate more groups. When a user clicks on "Add More" a new group is generated and becomes visible. Next to the group will be a button to delete this group.

Any other ideas are welcome!

@andrba
Copy link
Owner Author

andrba commented May 11, 2015

This became mostly a representation issue and has to be resolved in the dependant gems

@andrba andrba closed this as completed May 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant