Fix not being able to remove packages added by query field

This commit is contained in:
rubenwardy 2023-08-19 02:48:40 +01:00
parent cea315048b
commit 618a768f9a
2 changed files with 7 additions and 4 deletions

@ -84,9 +84,12 @@ function addPackage(pkg) {
</article> </article>
`; `;
const newElement = temp.children[0]; const card = temp.children[0];
document.getElementById("package_list").appendChild(newElement); document.getElementById("package_list").appendChild(card);
newElement.scrollIntoView(); card.scrollIntoView();
const button = card.querySelector(".btn-danger");
button.addEventListener("click", () => removePackage(card));
} }

@ -9,7 +9,7 @@
{% endblock %} {% endblock %}
{% block scriptextra %} {% block scriptextra %}
<script src="/static/collection_editor.js?v=2"></script> <script src="/static/collection_editor.js?v=3"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}