Close modals after submit

This commit is contained in:
Mouse Reeve 2021-09-09 08:06:36 -07:00
parent 053e2cea0d
commit 49f1226f3a
5 changed files with 10 additions and 4 deletions

View file

@ -74,6 +74,12 @@ let StatusCache = new class {
.forEach(node => window.localStorage.removeItem(node.dataset.cacheDraft));
// Close modals
let modal = form.closest(".modal.is-active");
if (!!modal) {
modal.getElementsByClassName("modal-close")[0].click();
}
// Update buttons
}
}();

View file

@ -9,7 +9,7 @@ Finish "<em>{{ book_title }}</em>"
{% endblock %}
{% block modal-form-open %}
<form name="finish-reading" action="{% url 'reading-status' 'finish' book.id %}" method="post">
<form name="finish-reading" action="{% url 'reading-status' 'finish' book.id %}" method="post" class="submit-status">
{% csrf_token %}
<input type="hidden" name="reading_status" value="read">
{% endblock %}

View file

@ -6,7 +6,7 @@
{% endblock %}
{% block modal-form-open %}
<form action="{% url 'edit-readthrough' %}" method="POST">
<form action="{% url 'edit-readthrough' %}" method="POST" class="submit-status">
{% endblock %}
{% block modal-body %}

View file

@ -9,7 +9,7 @@ Start "<em>{{ book_title }}</em>"
{% endblock %}
{% block modal-form-open %}
<form name="start-reading" action="{% url 'reading-status' 'start' book.id %}" method="post">
<form name="start-reading" action="{% url 'reading-status' 'start' book.id %}" method="post" class="submit-status">
<input type="hidden" name="reading_status" value="reading">
{% csrf_token %}
{% endblock %}

View file

@ -9,7 +9,7 @@ Want to Read "<em>{{ book_title }}</em>"
{% endblock %}
{% block modal-form-open %}
<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post">
<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post" class="submit-status">
<input type="hidden" name="reading_status" value="to-read">
{% csrf_token %}
{% endblock %}