diff --git a/cps/basic.py b/cps/basic.py index 9830d6c1..b0121010 100644 --- a/cps/basic.py +++ b/cps/basic.py @@ -19,6 +19,7 @@ # along with this program. If not, see . +from cps.pagination import Pagination from flask import Blueprint from flask_babel import gettext as _ from flask_babel import get_locale @@ -45,14 +46,16 @@ log = logger.create() @login_required_if_no_ano def index(): term = request.args.get("query", "") # default to showing all books - offset = 0 + limit = 15 + page = int(request.args.get("page") or 1) + off = (page - 1) * limit order = get_sort_function("stored", "search") join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series entries, result_count, pagination = calibre_db.get_search_results(term, config, - offset, + off, order, - None, + limit, *join) return render_title_template('basic_index.html', searchterm=term, diff --git a/cps/templates/basic_index.html b/cps/templates/basic_index.html index 9734c0d6..ae88087f 100644 --- a/cps/templates/basic_index.html +++ b/cps/templates/basic_index.html @@ -1,24 +1,32 @@ {% extends "basic_layout.html" %} {% block body %} -
- {% if entries|length < 1 %} -

{{_('No Results Found')}}

-

{{_('Search Term:')}} {{adv_searchterm}}

- {% endif %} - + +{% if entries|length < 1 %} +

{{_('No Results Found')}}

+{% endif %} + +{% for entry in entries %} + {% if entry.Books.authors %} + {% set author = entry.Books.authors[0].name.replace('|',',')|shortentitle(30) %} + {% else %} + {% set author = '' %} + {% endif %} + +

{{ author }} - {{entry.Books.title|shortentitle}}

+
+{% endfor %} + {% endblock %} diff --git a/cps/templates/basic_layout.html b/cps/templates/basic_layout.html index 01ffbfc0..a7f1d192 100644 --- a/cps/templates/basic_layout.html +++ b/cps/templates/basic_layout.html @@ -71,6 +71,20 @@ nav > a { height: 250px; object-fit: cover; } + +.listing { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-right: 20px; +} + +.pagination { + display: flex; + justify-content: space-between; + padding: 10px 0; + height: 20px; +}