1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-18 14:10:30 +00:00

Fix grid to list in series view

Fix sort asc, desc in author and series list
This commit is contained in:
Ozzieisaacs 2021-11-01 13:11:49 +01:00
parent b3b85bf692
commit a5415e00d5
4 changed files with 10 additions and 8 deletions

View File

@ -34,13 +34,14 @@ $("#desc").click(function() {
method:"post", method:"post",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/view", url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"desc\"}}", data: "{\"" + page + "\": {\"dir\": \"desc\"}}",
}); });
$list.isotope({ $list.isotope({
sortBy: "name", sortBy: "name",
sortAscending: true sortAscending: true
}); });
direction = 0;
}); });
$("#asc").click(function() { $("#asc").click(function() {
@ -52,13 +53,14 @@ $("#asc").click(function() {
method:"post", method:"post",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/view", url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"asc\"}}", data: "{\"" + page + "\": {\"dir\": \"asc\"}}",
}); });
$list.isotope({ $list.isotope({
sortBy: "name", sortBy: "name",
sortAscending: false sortAscending: false
}); });
direction = 1;
}); });
$("#all").click(function() { $("#all").click(function() {

View File

@ -73,7 +73,7 @@ $("#desc").click(function() {
method:"post", method:"post",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/view", url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"desc\"}}", data: "{\"" + page + "\": {\"dir\": \"desc\"}}",
}); });
var index = 0; var index = 0;
@ -121,7 +121,7 @@ $("#asc").click(function() {
method:"post", method:"post",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
url: window.location.pathname + "/../../ajax/view", url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"asc\"}}", data: "{\"" + page + "\": {\"dir\": \"asc\"}}",
}); });
var index = 0; var index = 0;

View File

@ -8,8 +8,8 @@
<button id="sort_name" class="btn btn-primary"><b>B,A <-> A B</b></button> <button id="sort_name" class="btn btn-primary"><b>B,A <-> A B</b></button>
{% endif %} {% endif %}
{% endif %} {% endif %}
<button id="asc" data-id="series" class="btn btn-primary"><span class="glyphicon glyphicon-sort-by-alphabet"></span></button> <button id="asc" data-id="series" data-order="{{ order }}" class="btn btn-primary"><span class="glyphicon glyphicon-sort-by-alphabet"></span></button>
<button id="desc" data-id="series" data-order="{{ order }}" class="btn btn-primary"><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></button> <button id="desc" data-id="series" class="btn btn-primary"><span class="glyphicon glyphicon-sort-by-alphabet-alt"></span></button>
{% if charlist|length %} {% if charlist|length %}
<button id="all" class="btn btn-primary">{{_('All')}}</button> <button id="all" class="btn btn-primary">{{_('All')}}</button>
{% endif %} {% endif %}

View File

@ -210,7 +210,7 @@ def toggle_archived(book_id):
@web.route("/ajax/view", methods=["POST"]) @web.route("/ajax/view", methods=["POST"])
@login_required_if_no_ano @login_required_if_no_ano
def update_view(): def update_view():
to_save = request.form.to_dict() # request.get_json() to_save = request.get_json()
try: try:
for element in to_save: for element in to_save:
for param in to_save[element]: 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()) \ .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() .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, 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: else:
entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count')) \ 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()) \ .join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters()) \