Skip to content
Snippets Groups Projects
Commit d2af0eb6 authored by Jared Hancock's avatar Jared Hancock
Browse files

filter: Fix javascript crash adding new filter

parent f2cac64e
No related branches found
No related tags found
No related merge requests found
...@@ -342,7 +342,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -342,7 +342,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
}; };
$(function() { $(function() {
$('#dynamic-actions').sortable({helper: fixHelper, opacity: 0.5}); $('#dynamic-actions').sortable({helper: fixHelper, opacity: 0.5});
var next = <?php echo $maxi; ?>; var next = <?php echo $maxi ?: 0; ?>;
$('#add-rule').click(function() { $('#add-rule').click(function() {
var clone = $('#new-rule-template tr').clone(); var clone = $('#new-rule-template tr').clone();
clone.find('[data-name=rulew]').attr('name', 'rules['+next+'][w]'); clone.find('[data-name=rulew]').attr('name', 'rules['+next+'][w]');
...@@ -351,5 +351,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -351,5 +351,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
clone.appendTo('#rules'); clone.appendTo('#rules');
next++; next++;
}); });
<?php if (!$info['rules']) { ?>
$('#add-rule').trigger('click').trigger('click');
<?php } ?>
}); });
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment