This commit is contained in:
cbartondock 2021-11-01 10:00:18 -04:00
commit 82164fc8e7
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()) \