You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
5 years ago
|
<!doctype html>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Admin</title>
|
||
|
<style>
|
||
|
img { border: 2px solid white; }
|
||
|
img.ui-selecting { border: 2px solid #f88; }
|
||
|
img.ui-selected { border: 2px solid #f22; }
|
||
|
</style>
|
||
|
<article>
|
||
|
$CONTENT
|
||
|
</article>
|
||
|
<script src="{{MEDIA_URL}}js/jquery-1.10.2.min.js"></script>
|
||
|
<script src="{{MEDIA_URL}}js/jquery-ui-1.8.16.min.js"></script>
|
||
|
<script>
|
||
|
var $del_button = $('<input type=button value=Delete>');
|
||
|
|
||
|
function delete_selected() {
|
||
|
// fgsfds
|
||
|
var threads = [];
|
||
|
$('img.ui-selected').each(function () {
|
||
|
threads.push(parseInt($(this).prop('alt')));
|
||
|
});
|
||
|
$del_button.val('Deleting ' + threads.length + '...');
|
||
|
$.ajax({
|
||
|
type: 'POST',
|
||
|
url: 'admin',
|
||
|
data: {threads: threads.join(), csrf: $CSRF},
|
||
|
success: function (data) {
|
||
|
$del_button.val('Deleted. Refresh.');
|
||
|
},
|
||
|
error: function (xhr, text, err) {
|
||
|
// TODO
|
||
|
alert(text);
|
||
|
$del_button.val('Failed.');
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
|
||
|
$(document).ready(function () {
|
||
|
$('article').selectable();
|
||
|
$('body').append($del_button.click(delete_selected));
|
||
|
});
|
||
|
</script>
|