Skip to content

Commit

Permalink
Next try showing last book of series in grid view
Browse files Browse the repository at this point in the history
  • Loading branch information
OzzieIsaacs committed Aug 27, 2023
1 parent 8535bb5 commit 6a14e2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cps/templates/grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1 class="{{page}}">{{_(title)}}</h1>
<div class="cover">
<a href="{{url_for('web.books_list', data=data, sort_param='stored', book_id=entry[0].series[0].id )}}">
<span class="img" title="{{entry[0].series[0].name}}">
{{ image.series(entry[0].series[0], alt=entry[0].series[0].name|shortentitle) }}
{{ image.book_cover(entry[0])}}
<span class="badge">{{entry.count}}</span>
</span>
</a>
Expand Down
20 changes: 14 additions & 6 deletions cps/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,13 +1002,21 @@ def series_list():
if no_series_count:
entries.append([db.Category(_("None"), "-1"), no_series_count])
entries = sorted(entries, key=lambda x: x[0].name.lower(), reverse=not order_no)
return render_title_template('list.html', entries=entries, folder='web.books_list', charlist=char_list,
title=_("Series"), page="serieslist", data="series", order=order_no)
return render_title_template('list.html',
entries=entries,
folder='web.books_list',
charlist=char_list,
title=_("Series"),
page="serieslist",
data="series", order=order_no)
else:
entries = calibre_db.session.query(db.Books, func.count('books_series_link').label('count'),
func.max(db.Books.series_index), db.Books.id) \
.join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters()) \
.group_by(text('books_series_link.series')).order_by(order).all()
entries = (calibre_db.session.query(db.Books, func.count('books_series_link').label('count'),
func.max(db.Books.series_index), db.Books.id)
.join(db.books_series_link).join(db.Series).filter(calibre_db.common_filters())
.group_by(text('books_series_link.series'))
.having(func.max(db.Books.series_index))
.order_by(order)
.all())
return render_title_template('grid.html', entries=entries, folder='web.books_list', charlist=char_list,
title=_("Series"), page="serieslist", data="series", bodyClass="grid-view",
order=order_no)
Expand Down

0 comments on commit 6a14e2c

Please sign in to comment.