After Deleting a book the list page is still displayed #1938
This commit is contained in:
parent
fac232229e
commit
78071841cc
|
@ -229,14 +229,14 @@ def modify_identifiers(input_identifiers, db_identifiers, db_session):
|
||||||
@editbook.route("/ajax/delete/<int:book_id>")
|
@editbook.route("/ajax/delete/<int:book_id>")
|
||||||
@login_required
|
@login_required
|
||||||
def delete_book_from_details(book_id):
|
def delete_book_from_details(book_id):
|
||||||
return Response(delete_book(book_id,"", True), mimetype='application/json')
|
return Response(delete_book(book_id, "", True), mimetype='application/json')
|
||||||
|
|
||||||
|
|
||||||
@editbook.route("/delete/<int:book_id>", defaults={'book_format': ""})
|
@editbook.route("/delete/<int:book_id>", defaults={'book_format': ""})
|
||||||
@editbook.route("/delete/<int:book_id>/<string:book_format>")
|
@editbook.route("/delete/<int:book_id>/<string:book_format>")
|
||||||
@login_required
|
@login_required
|
||||||
def delete_book_ajax(book_id, book_format):
|
def delete_book_ajax(book_id, book_format):
|
||||||
return delete_book(book_id,book_format, False)
|
return delete_book(book_id, book_format, False)
|
||||||
|
|
||||||
|
|
||||||
def delete_whole_book(book_id, book):
|
def delete_whole_book(book_id, book):
|
||||||
|
|
|
@ -142,10 +142,11 @@ $("#delete_confirm").click(function() {
|
||||||
//get data-id attribute of the clicked element
|
//get data-id attribute of the clicked element
|
||||||
var deleteId = $(this).data("delete-id");
|
var deleteId = $(this).data("delete-id");
|
||||||
var bookFormat = $(this).data("delete-format");
|
var bookFormat = $(this).data("delete-format");
|
||||||
|
var ajaxResponse = $(this).data("ajax");
|
||||||
if (bookFormat) {
|
if (bookFormat) {
|
||||||
window.location.href = getPath() + "/delete/" + deleteId + "/" + bookFormat;
|
window.location.href = getPath() + "/delete/" + deleteId + "/" + bookFormat;
|
||||||
} else {
|
} else {
|
||||||
if ($(this).data("delete-format")) {
|
if (ajaxResponse) {
|
||||||
path = getPath() + "/ajax/delete/" + deleteId;
|
path = getPath() + "/ajax/delete/" + deleteId;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method:"get",
|
method:"get",
|
||||||
|
@ -187,6 +188,7 @@ $("#deleteModal").on("show.bs.modal", function(e) {
|
||||||
}
|
}
|
||||||
$(e.currentTarget).find("#delete_confirm").data("delete-id", bookId);
|
$(e.currentTarget).find("#delete_confirm").data("delete-id", bookId);
|
||||||
$(e.currentTarget).find("#delete_confirm").data("delete-format", bookfomat);
|
$(e.currentTarget).find("#delete_confirm").data("delete-format", bookfomat);
|
||||||
|
$(e.currentTarget).find("#delete_confirm").data("ajax", $(e.relatedTarget).data("ajax"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user