app/assets/javascripts/crimagify/nested_forms.js in crimagify-0.0.4.0 vs app/assets/javascripts/crimagify/nested_forms.js in crimagify-0.0.4.1

- old
+ new

@@ -13,10 +13,12 @@ $new_fieldset.attr("id", "nested_"+i); $new_fieldset.attr("id","nested_" + i); $new_fieldset.find(".parent").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+i+'][parent]'); $new_fieldset.find(".parent_id").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+i+'][parent_id]'); $new_fieldset.find(".id_images").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+i+'][id_images]'); + // $new_fieldset.find(".remove").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+i+'][_destroy]'); + // $fieldset.find(".remove").removeAttr("id"); var imagesTemporal = $new_fieldset.find(".image_temporal"); for(var j = 0; j<imagesTemporal.length;j++){ var $inputImage = $(imagesTemporal[j]); var nameOld = $inputImage.attr("name"); $inputImage.attr('name',$this.data('parentobject') + '[' + $this.data('parent') + '_attributes][' + i + ']['+nameOld+']'); @@ -35,10 +37,12 @@ var $fieldset = $frmCrimagify.find(".fieldset_crimagify_nested").last(); $fieldset.attr("id","nested_" + time); $fieldset.find(".parent").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+time+'][parent]'); $fieldset.find(".parent_id").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+time+'][parent_id]'); $fieldset.find(".id_images").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+time+'][id_images]'); + // $fieldset.find(".remove").attr('name',$this.data('parentobject')+'['+$this.data('parent')+'_attributes]['+time+'][_destroy]'); + // $fieldset.find(".remove").removeAttr("id"); var imagesTemporal = $fieldset.find(".image_temporal"); for(var i = 0; i<imagesTemporal.length;i++){ var $inputImage = $(imagesTemporal[i]); var nameOld = $inputImage.attr("name"); $inputImage.attr('name',$this.data('parentobject') + '[' + $this.data('parent') + '_attributes][' + time + ']['+nameOld+']'); @@ -59,13 +63,17 @@ return new Date().getTime(); } function setAttributesNames($form){ var $fieldset = $form.find(".fieldset_crimagify_nested"); + // var $remove = $fieldset.find(".remove") + // for(var r = 0; r) $fieldset.attr("id","nested_0"); $fieldset.find(".parent").attr("name",$form.data("parentobject")+"["+$form.data("parent")+"_attributes]["+0+"][parent]"); $fieldset.find(".parent_id").attr("name",$form.data("parentobject")+"["+$form.data("parent")+"_attributes]["+0+"][parent_id]"); $fieldset.find(".id_images").attr("name",$form.data("parentobject")+"["+$form.data("parent")+"_attributes]["+0+"][id_images]"); + // $fieldset.find(".remove").attr("name",$form.data("parentobject")+"["+$form.data("parent")+"_attributes]["+0+"][_destroy]"); + // $fieldset.find(".remove").removeAttr("id"); var imagesTemporal = $fieldset.find(".image_temporal"); for(var i = 0; i<imagesTemporal.length;i++){ var $inputImage = $(imagesTemporal[i]); var nameOld = $inputImage.attr("name"); $inputImage.attr('name',$form.data('parentobject')+'['+$form.data('parent')+'_attributes]['+0+']['+nameOld+']'); \ No newline at end of file