-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteConfirmation.html
137 lines (131 loc) · 3.44 KB
/
deleteConfirmation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> jQuery Delete Confirmation </TITLE>
<link rel="stylesheet" href="http://regretless.com/stuff/webTips/styleATable/css/default.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
<!-- include smoothness jQueryUI theme -->
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/smoothness/jquery-ui.css">
<script type="text/javascript">
var deleteTheSelectedUrl = '';
$(document).ready(function() {
// create the jQuery modal window and set autoOpen to false
$("#jQueryDeleteConfirmationModalWindow").dialog({
title: "Delete Confirmation",
autoOpen: false, // set this to false so we can manually open it
dialogClass: "jQueryDeleteConfirmationModalWindow",
closeOnEscape: false,
draggable: false,
width: 460,
height: 260,
modal: true,
buttons: {
"Yes, I'm sure": function() {
$( this ).dialog( "close" );
if('' != jQuery.trim(deleteTheSelectedUrl)) {
window.location = deleteTheSelectedUrl;
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
resizable: false,
open: function() {
// scrollbar fix for IE
$('body').css('overflow','hidden');
},
close: function() {
// reset overflow
$('body').css('overflow','auto');
}
}); // end of dialog
// bind the loading screen to each delete link, assuming you have some kind of way to select them via jQuery
jQuery('a.deleteConfirmation').click(function() {
deleteTheSelectedUrl = $(this).attr('href');
var name = $(this).parent().parent().children('td.name').html(); // a.delete -> td -> tr -> td.name
name = jQuery.trim(name);
$("#jQueryDeleteConfirmationModalWindow").html('Are you sure you wish to delete ' + name + '?');
$("#jQueryDeleteConfirmationModalWindow").dialog('open');
return false;
});
});
</script>
</HEAD>
<BODY>
<div id="jQueryDeleteConfirmationModalWindow"></div>
<table class="people" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="first">
Name
</th>
<th>
Phone number
</th>
<th>
Date of birth
</th>
<th class="last">
Actions
</th>
</tr>
<tr class="odd">
<td class="name">
Mike White
</td>
<td class="phoneNumber">
123-456-789
</td>
<td class="dateOfBirth">
10/11/1976
</td>
<td class="actions">
<a href="#">Edit</a> <a href="delete.php?id=1" class="deleteConfirmation">Delete</a>
</td>
</tr>
<tr class="even">
<td class="name">
Nancy Green
</td>
<td class="phoneNumber">
987-644-311
</td>
<td class="dateOfBirth">
02/24/1950
</td>
<td class="actions">
<a href="#">Edit</a> <a href="delete.php?id=2" class="deleteConfirmation">Delete</a>
</td>
</tr>
<tr class="odd">
<td class="name">
Melissa Johnson
</td>
<td class="phoneNumber">
687-877-9787
</td>
<td class="dateOfBirth">
05/06/1984
</td>
<td class="actions">
<a href="#">Edit</a> <a href="delete.php?id=3" class="deleteConfirmation">Delete</a>
</td>
</tr>
<tr class="even">
<td class="name">
John Smith
</td>
<td class="phoneNumber">
987-987-4323
</td>
<td class="dateOfBirth">
11/21/1968
</td>
<td class="actions">
<a href="#">Edit</a> <a href="delete.php?id=4" class="deleteConfirmation">Delete</a>
</td>
</tr>
</table>
</BODY>
</HTML>