Undo check of read checkbox in case of error
Display error message in details modal dialog Bugfix set archive bit in booktable Translate error message readstatus change
This commit is contained in:
parent
8e2536c53b
commit
3b5e5f9b90
|
@ -1212,8 +1212,11 @@ def edit_list_book(param):
|
||||||
'newValue': ' & '.join([author.replace('|',',') for author in input_authors])}),
|
'newValue': ' & '.join([author.replace('|',',') for author in input_authors])}),
|
||||||
mimetype='application/json')
|
mimetype='application/json')
|
||||||
elif param == 'is_archived':
|
elif param == 'is_archived':
|
||||||
change_archived_books(book.id, vals['value'] == "True")
|
is_archived = change_archived_books(book.id, vals['value'] == "True",
|
||||||
ret = ""
|
message="Book {} archivebit set to: {}".format(book.id, vals['value']))
|
||||||
|
if is_archived:
|
||||||
|
kobo_sync_status.remove_synced_book(book.id)
|
||||||
|
return ""
|
||||||
elif param == 'read_status':
|
elif param == 'read_status':
|
||||||
ret = helper.edit_book_read_status(book.id, vals['value'] == "True")
|
ret = helper.edit_book_read_status(book.id, vals['value'] == "True")
|
||||||
if ret:
|
if ret:
|
||||||
|
|
|
@ -335,7 +335,7 @@ def edit_book_read_status(book_id, read_status=None):
|
||||||
except (OperationalError, InvalidRequestError) as e:
|
except (OperationalError, InvalidRequestError) as e:
|
||||||
calibre_db.session.rollback()
|
calibre_db.session.rollback()
|
||||||
log.error(u"Read status could not set: {}".format(e))
|
log.error(u"Read status could not set: {}".format(e))
|
||||||
return "Read status could not set: {}".format(e), 400
|
return _("Read status could not set: {}".format(e.orig))
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Deletes a book fro the local filestorage, returns True if deleting is successfull, otherwise false
|
# Deletes a book fro the local filestorage, returns True if deleting is successfull, otherwise false
|
||||||
|
|
|
@ -28,14 +28,24 @@ $("#have_read_cb").on("change", function() {
|
||||||
data: $(this).closest("form").serialize(),
|
data: $(this).closest("form").serialize(),
|
||||||
error: function(response) {
|
error: function(response) {
|
||||||
var data = [{type:"danger", message:response.responseText}]
|
var data = [{type:"danger", message:response.responseText}]
|
||||||
$("#flash_success").remove();
|
// $("#flash_success").parent().remove();
|
||||||
$("#flash_danger").remove();
|
$("#flash_danger").remove();
|
||||||
|
$(".row-fluid.text-center").remove();
|
||||||
if (!jQuery.isEmptyObject(data)) {
|
if (!jQuery.isEmptyObject(data)) {
|
||||||
data.forEach(function (item) {
|
$("#have_read_cb").prop("checked", !$("#have_read_cb").prop("checked"));
|
||||||
$(".navbar").after('<div class="row-fluid text-center" >' +
|
if($("#bookDetailsModal").is(":visible")) {
|
||||||
'<div id="flash_' + item.type + '" class="alert alert-' + item.type + '">' + item.message + '</div>' +
|
data.forEach(function (item) {
|
||||||
'</div>');
|
$(".modal-header").after('<div id="flash_' + item.type +
|
||||||
});
|
'" class="text-center alert alert-' + item.type + '">' + item.message + '</div>');
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
data.forEach(function (item) {
|
||||||
|
$(".navbar").after('<div class="row-fluid text-center" >' +
|
||||||
|
'<div id="flash_' + item.type + '" class="alert alert-' + item.type + '">' + item.message + '</div>' +
|
||||||
|
'</div>');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -515,6 +515,7 @@ $(function() {
|
||||||
|
|
||||||
$("#bookDetailsModal")
|
$("#bookDetailsModal")
|
||||||
.on("show.bs.modal", function(e) {
|
.on("show.bs.modal", function(e) {
|
||||||
|
$("#flash_danger").remove();
|
||||||
var $modalBody = $(this).find(".modal-body");
|
var $modalBody = $(this).find(".modal-body");
|
||||||
|
|
||||||
// Prevent static assets from loading multiple times
|
// Prevent static assets from loading multiple times
|
||||||
|
|
|
@ -812,11 +812,13 @@ function checkboxChange(checkbox, userId, field, field_index) {
|
||||||
|
|
||||||
function BookCheckboxChange(checkbox, userId, field) {
|
function BookCheckboxChange(checkbox, userId, field) {
|
||||||
var value = checkbox.checked ? "True" : "False";
|
var value = checkbox.checked ? "True" : "False";
|
||||||
|
var element = checkbox;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: getPath() + "/ajax/editbooks/" + field,
|
url: getPath() + "/ajax/editbooks/" + field,
|
||||||
data: {"pk": userId, "value": value},
|
data: {"pk": userId, "value": value},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
element.checked = !element.checked;
|
||||||
handleListServerResponse([{type:"danger", message:data.responseText}])
|
handleListServerResponse([{type:"danger", message:data.responseText}])
|
||||||
},
|
},
|
||||||
success: handleListServerResponse
|
success: handleListServerResponse
|
||||||
|
|
Loading…
Reference in New Issue
Block a user