Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
#3228 - add confirm modal for delete
  • Loading branch information
awwester committed Dec 1, 2015
commit 6d1ed851b5b5bce6c412745dac72b030fbf49d1b
5 changes: 5 additions & 0 deletions rest_framework/static/rest_framework/css/bootstrap-tweaks.css
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,8 @@ body a:hover {
width: 20px;
margin-top: 3px;
}

.modal-footer form {
margin-left: 5px;
margin-right: 5px;
}
22 changes: 19 additions & 3 deletions rest_framework/templates/rest_framework/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load staticfiles %}
{% load rest_framework %}
{% load i18n %}

<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -101,9 +102,24 @@
{% endif %}

{% if delete_form %}
<form class="button-form" action="{{ request.get_full_path }}" data-method="DELETE">
<button class="btn btn-danger js-tooltip" title="Make a DELETE request on the {{ name }} resource">DELETE</button>
</form>
<button class="btn btn-danger button-form js-tooltip" title="Make a DELETE request on the {{ name }} resource" data-toggle="modal" data-target="#deleteModal">DELETE</button>

<!-- Delete Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h4 class="text-center">Are you sure you want to delete this {{ name }}?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<form class="button-form" action="{{ request.get_full_path }}" data-method="DELETE">
<button class="btn btn-danger">Delete</button>
</form>
</div>
</div>
</div>
</div>
{% endif %}

{% if filter_form %}
Expand Down