diff --git a/maraudes/templates/maraudes/compterendu.html b/maraudes/templates/maraudes/compterendu.html index 794ed89..86efd66 100644 --- a/maraudes/templates/maraudes/compterendu.html +++ b/maraudes/templates/maraudes/compterendu.html @@ -30,77 +30,78 @@ $.fn.onAddForm = function(row) { // Load django_select2 fields row.find('.django-select2').djangoSelect2(); - var button = row.find('a.btn-delete') - var text = button.text() - button.html(' ' + text); }; $.fn.onDeleteForm = function(row) { /* * Custom code when deleting dynamic form */ + console.log(row); }; }); - $(function() { - $('.dynamic-formset').formset({ - prefix: '{{ inline_formset.prefix }}', - addText: 'Ajouter une personne', - deleteText: 'Supprimer', - addCssClass: 'card-link btn-sm btn-add', - deleteCssClass: 'card-link btn-sm btn-delete', - added: $.fn.onAddForm, - removed: $.fn.onDeleteForm - }); - - var text = $('a.btn-add').text() - $('a.btn-add').html('(+) ' + text) - text = $('a.btn-delete:first').text() - $('a.btn-delete').html('(-) ' + text); + + $(function() { + $('.dynamic-formset').formset({ + prefix: '{{ inline_formset.prefix }}', + addText: 'Ajouter une personne', + deleteText: 'Supprimer', + addCssClass: 'card-link btn-add', + deleteCssClass: 'btn-link btn-sm btn-delete pb-3', + added: $.fn.onAddForm, + removed: $.fn.onDeleteForm }); + + var text = $('a.btn-add').text(); + $('a.btn-add').html('(+) ' + text); + var text = $('a.btn-delete:first').text(); + $('a.btn-delete').html('(-) ' + text); + }); -