Prepare for save name sort order

This commit is contained in:
OzzieIsaacs 2020-08-23 09:13:44 +02:00
parent ed8275a20b
commit 4c38b0ab10
3 changed files with 19 additions and 11 deletions

View File

@ -19,13 +19,16 @@ var direction = 0; // Descending order
var sort = 0; // Show sorted entries
$("#sort_name").click(function() {
/*$.ajax({
var class_name = $("h1").attr('Class') + "_sort_name";
var obj = {};
obj[class_name] = sort;
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
data: "{" + st + "}",
});*/
data: JSON.stringify({obj}),
});
var count = 0;
var index = 0;

View File

@ -378,16 +378,19 @@ $(function() {
});
$(".update-view").click(function(e) {
var target = $(this).data("target");
var view = $(this).data("view");
e.preventDefault();
e.stopPropagation();
var data = {};
data[target] = view;
console.debug("Updating view data: ", data);
$.post( "/ajax/view", data).done(function( ) {
location.reload();
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
data: JSON.stringify({"series_view":view}),
success: function success() {
location.reload();
}
});
});
});

View File

@ -466,7 +466,7 @@ def toggle_archived(book_id):
@web.route("/ajax/view", methods=["POST"])
@login_required
def update_view():
to_save = request.form.to_dict()
to_save = request.get_json()
allowed_view = ['grid', 'list']
if "series_view" in to_save and to_save["series_view"] in allowed_view:
try:
@ -481,10 +481,12 @@ def update_view():
except Exception:
log.error("Could not save series_view_settings: %r %r", request, to_save)
return "Invalid request", 400
elif "authorslist" in to_save:
pass
else:
log.error("Invalid request received: %r %r", request, to_save)
return "Invalid request", 400
return "", 200
return "1", 200
'''