platanus / activeadmin_addons

Extends ActiveAdmin to enable a set of great optional UX improving add-ons
MIT License
758 stars 287 forks source link

Allow nested_select multiple: true option #270

Open shartep opened 5 years ago

shartep commented 5 years ago

I find this PR https://github.com/platanus/activeadmin_addons/pull/72 (created by @groony ) it looks like this feature should be already present, bu I did not find any documentation on how to activate and use it, I try:

f.input :city_ids, as: :nested_select, multiple: true,
                  level_1: { attribute: :country_id },
                  level_2: { attribute: :region_id },
                  level_3: { attribute: :city_ids }

or

f.input :city_ids, as: :nested_select, 
                  level_1: { attribute: :country_id },
                  level_2: { attribute: :region_id },
                  level_3: { attribute: :city_ids, multiple: true }

and it is not works for me, cities select still not provide ability to select several cities.

It will be very useful to add ability to use nested_select with multiple: true option for has_many and has_and_belongs_to_many associations. Here is workflow, related to example in README:

More complicated variant: in addition to workflow above:

And one more complicated case: use multiple: true for each level, so user can select several Countries, and several Regions to see Cities related to one of selected Region

mashedkeyboard commented 5 years ago

I was just thinking about this same thing - would be really useful to see support for this use case.

gen1321 commented 4 years ago

I do have working solution on this problem, but it needs https://github.com/platanus/activeadmin_addons/pull/264 to work properly

I will make pr as soon as 264 pr will be merged

rjherrera commented 4 years ago

@gen1321 Nice! I asked the author of that PR to rebase his branch, so we can merge it but it seems that it was too late. Maybe if you have a working solution for that PR also, we could review it and eventually merge it.

jgmontoya commented 4 years ago

Hey @gen1321 just letting you know that #264 has been merged!

sleivav commented 3 years ago

@gen1321 do you still plan sending that PR? If you don't, I'll try to implement this myself