Skip to content

Commit 0215f9e

Browse files
committed
add sweetalert css and confirm_btn
1 parent 777b5b4 commit 0215f9e

File tree

9 files changed

+749
-8
lines changed

9 files changed

+749
-8
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ url(r'^adminlte/', include('adminlte.urls')),
4545
6 Look the examples in the code to see how to start.
4646

4747

48+
# How to run example
49+
50+
```
51+
PYTHONPATH=PYTHONPATH:. python examples/demo/manage.py runserver
52+
```
53+
54+
4855
## Settings
4956

5057
### ADMINLTE_LOGIN_VIEW

adminlte/static/js/adminlte.js

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1-
$(document).ready(function() {
1+
$(document).ready(function () {
22
$(".click_sorting").on('click', function () {
33
var desc = $(this).data('desc');
44
var field = $(this).data('field');
55
// 此处如果desc为0则是正序排列,点击后改为逆序排列
66
var search = '?order_by=' + (desc ? "" : "-") + field;
77

88
var form_data_array = $("#listForm").serializeArray();
9-
for(var i = 0; i < form_data_array.length; i++) {
9+
for (var i = 0; i < form_data_array.length; i++) {
1010
var item = form_data_array[i];
11-
if(item.name != 'order_by') {
11+
if (item.name != 'order_by') {
1212
search += '&' + item.name + '=' + item.value;
1313
}
1414
}
1515

1616

1717
window.location = window.location.pathname + search;
1818
});
19+
20+
$(".confirm-to-href-btn").on('click', function () {
21+
var href = $(this).data('href');
22+
console.log('start to confirm. href:', href);
23+
if (!href) {
24+
swal("To Coder!", "you need add data-href on your button!");
25+
return false;
26+
}
27+
swal({
28+
title: "Are you sure?",
29+
type: "warning",
30+
showCancelButton: true,
31+
confirmButtonClass: "btn-danger",
32+
confirmButtonText: "Yes",
33+
closeOnConfirm: false
34+
},
35+
function () {
36+
console.log('confirmed!');
37+
window.location = href;
38+
});
39+
console.log('end to confirm');
40+
return false;
41+
});
1942
});

0 commit comments

Comments
 (0)