Permalink
Browse files

fix js under 'add field' link for entity generation

  • Loading branch information...
1 parent f9bd45c commit 7e011ebb9a07131097340a4f8e82c87b9f142962 @RapotOR committed Aug 1, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 Resources/views/Entity/generate.html.twig
@@ -35,14 +35,15 @@
$(document).ready(function () {
{% include 'Sf2genGeneratorBundle::js_autocomplete.html.twig' with {'id': 'generateentity_bundle', 'path':'_generator_bundles'} %}
- entity_fields_prototype = $('#generateentity_fields_prototype');
+ entity_fields_prototype = $('#generateentity_fields');
var button = $('a.entity_fields');
button.click(function(event) {
event.preventDefault();
- var index = entity_fields_prototype.parent('div').find(' > div').size();
- row = $(entity_fields_prototype[0].innerHTML).clone(true);
+ var index = entity_fields_prototype.find(' > div.symfony-form-row').size();
+ row = $($(entity_fields_prototype).attr('data-prototype')).clone(true);
+ row.find(' > label').hide();
row.find('*[id*="$$name$$"]').each(function() {
var attribute;
attribute = 'id';
@@ -56,7 +57,7 @@
attribute = 'for';
$(this).attr(attribute, $(this).attr(attribute).replace(/\$\$name\$\$/g, index));
});
- entity_fields_prototype.closest('div').append(row);
+ entity_fields_prototype.append(row);
row.show();
});
});

0 comments on commit 7e011eb

Please sign in to comment.