Skip to content

Commit

Permalink
minor #2375 Make add new item javascript in collections use the corre…
Browse files Browse the repository at this point in the history
…ct prototype name. (moynzzz)

This PR was merged into the 1.x branch.

Discussion
----------

Make add new item javascript in collections use the correct prototype name.

This PR fixes #2210. It makes the javascript use the correct variable for the prototype name property in order to replace it in the newly created fields.

Commits
-------

26fcdf0 Make add new item javascript in collections use the correct prototype name.
  • Loading branch information
javiereguiluz committed Oct 4, 2018
2 parents 7a88c20 + 26fcdf0 commit fe1a62d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Resources/views/form/bootstrap_3_layout.html.twig
Expand Up @@ -297,9 +297,9 @@
collection.prev('.collection-empty').remove();

var newItem = collection.attr('data-prototype')
.replace(/\>__name__label__\</g, '>' + numItems + '<')
.replace(/_{{ name }}___name__/g, '_{{ name }}_' + numItems)
.replace(/{{ name }}\]\[__name__\]/g, '{{ name }}][' + numItems + ']')
.replace(/\>{{ prototype.vars.name }}label__\</g, '>' + numItems + '<')
.replace(/_{{ name }}_{{ prototype.vars.name }}/g, '_{{ name }}_' + numItems)
.replace(/{{ name }}\]\[{{ prototype.vars.name }}\]/g, '{{ name }}][' + numItems + ']')
;

// Increment the counter and store it in the collection
Expand Down

0 comments on commit fe1a62d

Please sign in to comment.