modals for state definition deletion
This commit is contained in:
parent
8dc5bf1435
commit
b3c268a49e
|
@ -26,10 +26,9 @@
|
||||||
<strong> {{ state_definition.state }}</strong> <br>
|
<strong> {{ state_definition.state }}</strong> <br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="#">
|
<button type="button" class="btn btn-danger btn-sm" data-bs-toggle="modal" data-bs-target="#deleteStateModal{{ state_definition.id }}">
|
||||||
{% csrf_token %}
|
{% trans "Delete" %}
|
||||||
<button type="submit" class="btn btn-danger btn-sm">{% trans "Delete" %}</button>
|
</button>
|
||||||
</form>
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -41,6 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- add state definition Modal -->
|
||||||
<div class="modal fade" id="addStateModal" tabindex="-1" aria-labelledby="addStateModalLabel" aria-hidden="true">
|
<div class="modal fade" id="addStateModal" tabindex="-1" aria-labelledby="addStateModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
@ -68,25 +68,36 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<!-- delete state definition Modal -->
|
||||||
$(function() {
|
{% if state_definitions %}
|
||||||
$("#sortable").sortable({
|
{% for state_definition in state_definitions %}
|
||||||
update: function(event, ui) {
|
<div class="modal fade" id="deleteStateModal{{ state_definition.id }}" tabindex="-1" aria-labelledby="deleteStateModalLabel{{ state_definition.id }}" aria-hidden="true">
|
||||||
var order = $(this).sortable('toArray', { attribute: 'data-id' });
|
<div class="modal-dialog">
|
||||||
$.ajax({
|
<div class="modal-content">
|
||||||
url: " ",
|
<div class="modal-header">
|
||||||
method: "POST",
|
<h5 class="modal-title" id="deleteStateModalLabel{{ state_definition.id }}">{% trans "Delete State Definition" %}</h5>
|
||||||
data: {
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
order: order,
|
</div>
|
||||||
csrfmiddlewaretoken: '{{ csrf_token }}'
|
<div class="modal-body">
|
||||||
},
|
<p>{% trans "Are you sure you want to delete this state definition?" %}</p>
|
||||||
success: function(response) {
|
<div class="d-flex align-items-center mt-3">
|
||||||
location.reload();
|
<span class="me-4 display-7">{{ state_definition.order }}</span>
|
||||||
}
|
<div>
|
||||||
});
|
<strong> {{ state_definition.state }}</strong> <br>
|
||||||
}
|
</div>
|
||||||
});
|
</div>
|
||||||
$("#sortable").disableSelection();
|
</div>
|
||||||
});
|
<div class="modal-footer">
|
||||||
</script>
|
<form method="post" action="{% url 'admin:delete_state_definition' state_definition.order %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
||||||
|
<button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue