Skip to content

Commit d2f90fd

Browse files
committed
Merge pull request #3662 from awwester/ticket_3228
#3228 - add confirm modal for delete
2 parents 832d632 + 6d1ed85 commit d2f90fd

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

rest_framework/static/rest_framework/css/bootstrap-tweaks.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,8 @@ body a:hover {
227227
width: 20px;
228228
margin-top: 3px;
229229
}
230+
231+
.modal-footer form {
232+
margin-left: 5px;
233+
margin-right: 5px;
234+
}

rest_framework/templates/rest_framework/base.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% load staticfiles %}
22
{% load rest_framework %}
33
{% load i18n %}
4+
45
<!DOCTYPE html>
56
<html>
67
<head>
@@ -101,9 +102,24 @@
101102
{% endif %}
102103

103104
{% if delete_form %}
104-
<form class="button-form" action="{{ request.get_full_path }}" data-method="DELETE">
105-
<button class="btn btn-danger js-tooltip" title="Make a DELETE request on the {{ name }} resource">DELETE</button>
106-
</form>
105+
<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>
106+
107+
<!-- Delete Modal -->
108+
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
109+
<div class="modal-dialog">
110+
<div class="modal-content">
111+
<div class="modal-body">
112+
<h4 class="text-center">Are you sure you want to delete this {{ name }}?</h4>
113+
</div>
114+
<div class="modal-footer">
115+
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
116+
<form class="button-form" action="{{ request.get_full_path }}" data-method="DELETE">
117+
<button class="btn btn-danger">Delete</button>
118+
</form>
119+
</div>
120+
</div>
121+
</div>
122+
</div>
107123
{% endif %}
108124

109125
{% if filter_form %}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy