diff --git a/cps/static/js/filter_grid.js b/cps/static/js/filter_grid.js index 623ffdc1..7043131a 100644 --- a/cps/static/js/filter_grid.js +++ b/cps/static/js/filter_grid.js @@ -34,13 +34,14 @@ $("#desc").click(function() { method:"post", contentType: "application/json; charset=utf-8", dataType: "json", - url: window.location.pathname + "/../../ajax/view", + url: getPath() + "/ajax/view", data: "{\"" + page + "\": {\"dir\": \"desc\"}}", }); $list.isotope({ sortBy: "name", sortAscending: true }); + direction = 0; }); $("#asc").click(function() { @@ -52,13 +53,14 @@ $("#asc").click(function() { method:"post", contentType: "application/json; charset=utf-8", dataType: "json", - url: window.location.pathname + "/../../ajax/view", + url: getPath() + "/ajax/view", data: "{\"" + page + "\": {\"dir\": \"asc\"}}", }); $list.isotope({ sortBy: "name", sortAscending: false }); + direction = 1; }); $("#all").click(function() { diff --git a/cps/static/js/filter_list.js b/cps/static/js/filter_list.js index b8f79f4e..e76e6147 100644 --- a/cps/static/js/filter_list.js +++ b/cps/static/js/filter_list.js @@ -73,7 +73,7 @@ $("#desc").click(function() { method:"post", contentType: "application/json; charset=utf-8", dataType: "json", - url: window.location.pathname + "/../../ajax/view", + url: getPath() + "/ajax/view", data: "{\"" + page + "\": {\"dir\": \"desc\"}}", }); var index = 0; @@ -121,7 +121,7 @@ $("#asc").click(function() { method:"post", contentType: "application/json; charset=utf-8", dataType: "json", - url: window.location.pathname + "/../../ajax/view", + url: getPath() + "/ajax/view", data: "{\"" + page + "\": {\"dir\": \"asc\"}}", }); var index = 0; diff --git a/cps/templates/grid.html b/cps/templates/grid.html index 5de80caf..ee623dc1 100644 --- a/cps/templates/grid.html +++ b/cps/templates/grid.html @@ -8,8 +8,8 @@ {% endif %} {% endif %} - - + + {% if charlist|length %} {% endif %} diff --git a/cps/web.py b/cps/web.py index 5f2f6638..47b3b49b 100644 --- a/cps/web.py +++ b/cps/web.py @@ -210,7 +210,7 @@ def toggle_archived(book_id): @web.route("/ajax/view", methods=["POST"]) @login_required_if_no_ano def update_view(): - to_save = request.form.to_dict() # request.get_json() + to_save = request.get_json() try: for element in to_save: for param in to_save[element]: @@ -927,7 +927,7 @@ def series_list(): .join(db.books_series_link).join(db.Books).filter(calibre_db.common_filters()) \ .group_by(func.upper(func.substr(db.Series.sort, 1, 1))).all() return render_title_template('list.html', entries=entries, folder='web.books_list', charlist=charlist, - title=_(u"Series"), page="serieslist", data="series") + title=_(u"Series"), page="serieslist", data="series", order=order_no) else: entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count')) \ .join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters()) \