Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

3 Level nested form bug #276

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

3 Level nested form bug #276

wants to merge 10 commits into from

Conversation

BenZhang
Copy link

@BenZhang BenZhang commented Jul 9, 2013

If specify target to #milestone-fields, like with_target_links.html.erb case, create a new task then remove it. And then add another new task again, at this point, whatever new milestone you try to add to the new task would go to the task that we have removed. Please refer to the test case for details.

@BenZhang
Copy link
Author

BenZhang commented Jan 8, 2014

Hi, I have tried use different way to test whether a html element is visible or not, but cannot pass all the platforms. Any thought would be appreciated. @lest

BenZhang and others added 8 commits February 7, 2017 15:44
Fix same nested association name bug
When nested form create blueprint according to the nested association,
the format of name and id is as below:

name="api_endpoint[parameters_attributes][0][children_attributes][0][children_attributes][new_children][required]"
id="api_endpoint_parameters_attributes_0_children_attributes_0_children_attributes_new_children_required"

In previous code, regexp below will mismatch "[children_attributes][new_children]"

RegExp('(\[' + parentNames[i] + '\])\[.+?\]', 'g')
	=> /(\[parameters_attributes\])\[.+?\]/g
	=> /(\[children_attributes\])\[.+?\]/g

In order to filter "new_children", chang the regexp into:

RegExp('(\[' + parentNames[i] + '\])\[[0-9]+?\]', 'g')
When create nested form, name and id in  created blueprint is in format as below:

id="api_endpoint_parameters_attributes_xxx_children_attributes_xxx_children_attributes_new_children_required"

name="api_endpoint[parameters_attributes][xxx][children_attributes][xxx][children_attributes][new_children][required]"

To correctly create nested form, we use regular expression to match parent pattern in id and name:

=>_parameters_attributes_xxx_children_attributes_xxx
=>[parameters_attributes][xxx][children_attributes][xxx]

Then replace them with ones we find from closest parent.
Modify the logic of replace name and id pattern from parents
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants