Implement AJAX deletion in /pages in order to remove redirect in /delete route.
This commit is contained in:
@@ -58,6 +58,22 @@ $(document).ready(function() {
|
||||
e.preventDefault();
|
||||
} );
|
||||
|
||||
$('.delete-file').click( function(e) {
|
||||
var ok = confirm($(this).data('confirm'));
|
||||
if ( ok ) {
|
||||
var element = $(this);
|
||||
$.post('<%=delete_path %>' + $(this).data('file-path'),
|
||||
{},
|
||||
function (result) {
|
||||
// page successfully deleted, stay on page but remove element from DOM
|
||||
element.closest("li").remove();
|
||||
});
|
||||
}
|
||||
// Don't navigate on cancel.
|
||||
e.preventDefault();
|
||||
} );
|
||||
|
||||
|
||||
var nodeSelector = {
|
||||
node1: null,
|
||||
node2: null,
|
||||
|
||||
Reference in New Issue
Block a user