-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
[FEATURE REQUEST] Make cocooned_item support HTML table tag #55
Comments
Hi @m3thom I just pushed a new branch named If everything looks fine, I'll publish it in a new release (2.1.0). |
Hi @gael-ian I try to install and play around with the change. It's works for me. Thank you! |
Great! I'll just wait a few days for answer on other open issues and will publish a new release. It should be before the end of week. |
I can close these issue as changes to support requested feature have been merged (See #56) and will be release before the end of the day in Cocooned 2.1.0. |
Hi, I really like this gem. I have used the
nested_form
andcocoon
gems for a long time, and I found this gem suits me very well! Thank you for creating this amazing gem.However, when I try to use
cocooned_container
andcocooned_item
with an HTML table, it did not work out of the box.Refer to https://github.com/notus-sh/cocooned?tab=readme-ov-file#2-signal-to-cocooned-it-should-handle-your-form
If I want to implement it using the
table
tag:For
cocooned_container
For
cocooned_item
The problem here is when I try to click the
Add
link, the added item is not rendered properly becausecocooned_item
wraps thetr
template with adiv
.But the
tr
tag does not allow wrapping with adiv
, so theitem_fields
are not added properly.After a quick look into the code of
cocooned_item
, it only addsclass="cocooned-item nested-fields"
anddata-cocooned-item="true"
to thediv
.So I tried to change my code:
And it works! Items can be added or removed without any problem.
Is it possible to add an option to the
cocooned_item
method to specify a tag name ofcontent_tag
other than the default:div
?I don't know if doing so would break anything internally now or in the future.
Thank you in advance! 🚀
The text was updated successfully, but these errors were encountered: