1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-26 21:07:40 +00:00

Back function implemented for delete book and edit book

This commit is contained in:
Ozzie Isaacs
2024-02-26 15:07:59 +01:00
parent 117c92233d
commit e860b4e097
10 changed files with 42 additions and 32 deletions

View File

@@ -20,7 +20,7 @@ function getPath() {
return jsFileLocation.substr(0, jsFileLocation.search("/static/js/libs/jquery.min.js")); // the js folder path
}
function postButton(event, action){
function postButton(event, action, location=""){
event.preventDefault();
var newForm = jQuery('<form>', {
"action": action,
@@ -30,7 +30,14 @@ function postButton(event, action){
'name': 'csrf_token',
'value': $("input[name=\'csrf_token\']").val(),
'type': 'hidden'
})).appendTo('body');
})).appendTo('body')
if(location !== "") {
newForm.append(jQuery('<input>', {
'name': 'location',
'value': location,
'type': 'hidden'
})).appendTo('body');
}
newForm.submit();
}
@@ -212,17 +219,20 @@ $("#delete_confirm").click(function(event) {
$( ".navbar" ).after( '<div class="row-fluid text-center" >' +
'<div id="flash_'+item.type+'" class="alert alert-'+item.type+'">'+item.message+'</div>' +
'</div>');
}
});
$("#books-table").bootstrapTable("refresh");
}
});
} else {
postButton(event, getPath() + "/delete/" + deleteId);
var loc = sessionStorage.getItem("back");
if (!loc) {
loc = $(this).data("back");
}
sessionStorage.removeItem("back");
postButton(event, getPath() + "/delete/" + deleteId, location=loc);
}
}
});
//triggered when modal is about to be shown