Skip to content

#3228 - add confirm modal for delete #3662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2015
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
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