From 95371d0d7f22479f20cf764ed5e9b94dc37f4f28 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 2 Nov 2021 20:27:50 +0400 Subject: [PATCH] Fix shelf grid ordering for inverted order at page load Ordering buttons now visible on medium size screens --- cps/static/js/filter_grid.js | 10 ++++++---- cps/templates/author.html | 2 +- cps/templates/grid.html | 10 ++++------ cps/templates/index.html | 2 +- cps/templates/list.html | 10 ++++------ cps/templates/search.html | 2 +- cps/templates/shelf.html | 2 +- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/cps/static/js/filter_grid.js b/cps/static/js/filter_grid.js index 7043131a..d84cf57a 100644 --- a/cps/static/js/filter_grid.js +++ b/cps/static/js/filter_grid.js @@ -21,10 +21,11 @@ var $list = $("#list").isotope({ itemSelector: ".book", layoutMode: "fitRows", getSortData: { - title: ".title", - } + title: ".title" + }, }); + $("#desc").click(function() { if (direction === 0) { return; @@ -37,9 +38,10 @@ $("#desc").click(function() { url: getPath() + "/ajax/view", data: "{\"" + page + "\": {\"dir\": \"desc\"}}", }); + // invert sorting order to make already inverted start order working $list.isotope({ sortBy: "name", - sortAscending: true + sortAscending: !$list.data('isotope').options.sortAscending }); direction = 0; }); @@ -58,7 +60,7 @@ $("#asc").click(function() { }); $list.isotope({ sortBy: "name", - sortAscending: false + sortAscending: !$list.data('isotope').options.sortAscending }); direction = 1; }); diff --git a/cps/templates/author.html b/cps/templates/author.html index d82b2ebd..4ae2df42 100644 --- a/cps/templates/author.html +++ b/cps/templates/author.html @@ -22,7 +22,7 @@ {% if author is not none %}

{{_("In Library")}}

{% endif %} -