hungle00 / rondo_form

Same as Cocoon, but using StimulusJS https://rubygems.org/gems/rondo_form
MIT License
65 stars 4 forks source link

Support passing locals #10

Open dirschn opened 3 months ago

dirschn commented 3 months ago

Couple things to say here- I noticed in cocoon they passed locals as part of html_options which didn't make sense to me, since they're completely separate. As such, I broke from the "cocoon-ness" of this gem to provide this functionality in a way that made the most sense to me. I will note however that this PR introduces breaking changes, which is likely the reason cocoon did it the way they did.

If you were to ask my opinion, I'd say to go with this implementation and merge it with a major version upgrade.

I can refactor to implement the way cocoon did, if you're very against this format, though.

I also renamed partial_name to partial to match Rails

I will add a documentation update with usage examples once I have your decision about what implementation you'd like to go with

hungle00 commented 3 months ago

@dirschn Thanks for your contribution! I wonder what you want to do with render_options or the difference is between render_options and html_options. Please give a detailed guide about what developers can use with render_options

dirschn commented 3 months ago

Sorry for the delay, been quite busy lately. I'd be happy to make some adjustments to the documentation to reflect the changes I've made here. I'll try to get that done in the next few days.

dirschn commented 2 months ago

I added a section to the read me with some documentation covering the view helpers in the style of the Rails api docs but to answer your question more specifically:

Prior to this PR, there is no way to pass local variables to the partial rendered by link_to_add_association. This PR adds that ability, using the render_options parameter. I also refactored partial_name to be passed in render_options (using partial like you would normally), rather than html_options, as it's only relevant to render. I thought about renaming html_options to link_to_options which would be a bit more descriptive to developers about what exactly it's for. Thoughts?

I hope this helps to clear it up a bit... Let me know if you need more explanation!

dirschn commented 2 months ago

Hi @hungle00! I'm just checking in to see whether you are waiting on more from me or if you're just busy? Totally fine if you're busy, I just want to make sure I'm not missing anything!