You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
First, thanks a lot for this wonderful gem - made my life much easier!
This is more of a solution to a problem that kept me up for a few hours which I think more can enjoy.
I am working on a form with multiple nesting levels and came across a problem with getting add_link_to to add the third level element only to the second level it is related to, after some trials I was forced to hack the javascript code a little and to add another data attribute in order to get it to work the way I wanted.
I made the following changes:
in the js file I made these changes:
once this was done it was easy, all I had to do was to tell add_link_to on which parent to hang the blueprint:
First, mark the the appropriate fields, e.g.
Second, let js know what parent to start looking for the fields to hang the blueprint, e.g. <%= f.link_to_add(content_tag(:span, "clickme"), :your_model, data: { target: ".theTarget", down_parent: '.fieldsAddedToMe' }) %>
This will search for fields related to fieldsAddedToMe only under the theTarget element, rails takes care of the rest.
The text was updated successfully, but these errors were encountered:
I had solved this problem by sending everytime all the form_builders variables in the nested partials with a different name : level1_f, level2_f....
Therefore i could generate appropriate IDs using ##{level1_f.index}-#{level2_f.index}...
(then I can tag some HTML with this ID, and use it as a target for link_to_add)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
First, thanks a lot for this wonderful gem - made my life much easier!
This is more of a solution to a problem that kept me up for a few hours which I think more can enjoy.
I am working on a form with multiple nesting levels and came across a problem with getting add_link_to to add the third level element only to the second level it is related to, after some trials I was forced to hack the javascript code a little and to add another data attribute in order to get it to work the way I wanted.
I made the following changes:
in the js file I made these changes:
once this was done it was easy, all I had to do was to tell add_link_to on which parent to hang the blueprint:
First, mark the the appropriate fields, e.g.
Second, let js know what parent to start looking for the fields to hang the blueprint, e.g.
<%= f.link_to_add(content_tag(:span, "clickme"), :your_model, data: { target: ".theTarget", down_parent: '.fieldsAddedToMe' }) %>
This will search for fields related to fieldsAddedToMe only under the theTarget element, rails takes care of the rest.
The text was updated successfully, but these errors were encountered: