Skip to content

Commit

Permalink
Fix wrong comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Jul 3, 2024
1 parent 7d5fd9f commit 2850f89
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions static/midcom.datamanager/subform.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ function init_subform(id, sortable, allow_add, allow_delete) {
if ( container.data('max-count') > 0
&& container.data('max-count') >= container.find('fieldset').length
&& container.find('.add-item').length === 0) {
if(allow_add === true) {
if (allow_add === true) {
container.append(add_button);
}
}
});

container.children().each(function() {
if(allow_delete === true) {
if (allow_delete === true) {
$(this).prepend(delete_button.clone());
}
index++;
Expand Down Expand Up @@ -63,13 +63,13 @@ function add_form(container, add_button, delete_button, sortable, allow_delete)
index = container.data('index'),
new_form = $(prototype.replace(/__name__/g, 'new-' + index))
.insertBefore(add_button);
if(allow_delete === true) {
if (allow_delete === true) {
new_form.prepend(delete_button.clone());
}
container.data('index', index + 1);

if ( container.data('max-count') > 0
&& container.data('max-count') >= container.find('> :not(.button.add-item)').length) {
&& container.data('max-count') <= container.find('> :not(.button.add-item)').length) {
add_button.detach();
}
if (sortable === true) {
Expand Down

0 comments on commit 2850f89

Please sign in to comment.