From 754b9832e95081b22e22e91dd57b65cf595adf37 Mon Sep 17 00:00:00 2001
From: celogeek <65178+celogeek@users.noreply.github.com>
Date: Sat, 17 Oct 2020 13:30:19 +0200
Subject: [PATCH 2/5] fix height container
---
cps/static/css/style.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/cps/static/css/style.css b/cps/static/css/style.css
index 6b3cba15..abe0ca48 100644
--- a/cps/static/css/style.css
+++ b/cps/static/css/style.css
@@ -111,6 +111,7 @@ a, .danger,.book-remove, .editable-empty, .editable-empty:hover { color: #45b29d
display: block;
max-width: 100%;
height: auto;
+ max-height: 100%;
}
.container-fluid .discover{ margin-bottom: 50px; }
From b2594468b41b3ce99f732543bd79ee13a4463258 Mon Sep 17 00:00:00 2001
From: celogeek <65178+celogeek@users.noreply.github.com>
Date: Sat, 17 Oct 2020 16:49:06 +0200
Subject: [PATCH 3/5] add helper to get all read books
---
cps/helper.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/cps/helper.py b/cps/helper.py
index 82d0b232..71dd2cc4 100644
--- a/cps/helper.py
+++ b/cps/helper.py
@@ -819,3 +819,18 @@ def get_download_link(book_id, book_format, client):
return do_download_file(book, book_format, client, data1, headers)
else:
abort(404)
+
+
+def get_readbooks_ids():
+ if not config.config_read_column:
+ readBooks = ub.session.query(ub.ReadBook).filter(ub.ReadBook.user_id == int(current_user.id))\
+ .filter(ub.ReadBook.is_read == True).all()
+ return frozenset([x.book_id for x in readBooks])
+ else:
+ try:
+ readBooks = calibre_db.session.query(db.cc_classes[config.config_read_column])\
+ .filter(db.cc_classes[config.config_read_column].value == True).all()
+ return frozenset([x.book for x in readBooks])
+ except KeyError:
+ log.error("Custom Column No.%d is not existing in calibre database", config.config_read_column)
+ return []
\ No newline at end of file
From 7d28963a32769f9749d2478241281422e3809bee Mon Sep 17 00:00:00 2001
From: celogeek <65178+celogeek@users.noreply.github.com>
Date: Sat, 17 Oct 2020 16:49:38 +0200
Subject: [PATCH 4/5] connect read books to all render
---
cps/web.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cps/web.py b/cps/web.py
index aa1cac1a..a3eb37d5 100644
--- a/cps/web.py
+++ b/cps/web.py
@@ -59,7 +59,8 @@ from . import calibre_db
from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download
from .helper import check_valid_domain, render_task_status, \
get_cc_columns, get_book_cover, get_download_link, send_mail, generate_random_password, \
- send_registration_mail, check_send_to_kindle, check_read_formats, tags_filters, reset_password
+ send_registration_mail, check_send_to_kindle, check_read_formats, tags_filters, reset_password, \
+ get_readbooks_ids
from .pagination import Pagination
from .redirect import redirect_back
@@ -602,7 +603,7 @@ def get_matching_tags():
def render_title_template(*args, **kwargs):
sidebar = ub.get_sidebar_config(kwargs)
return render_template(instance=config.config_calibre_web_title, sidebar=sidebar,
- accept=constants.EXTENSIONS_UPLOAD,
+ accept=constants.EXTENSIONS_UPLOAD, read_book_ids=get_readbooks_ids(),
*args, **kwargs)
From 4d81d3613ca7baa9416c82193186efc4f31b8e99 Mon Sep 17 00:00:00 2001
From: celogeek <65178+celogeek@users.noreply.github.com>
Date: Sat, 17 Oct 2020 16:49:57 +0200
Subject: [PATCH 5/5] display the check when books are read
---
cps/templates/author.html | 5 ++++-
cps/templates/discover.html | 5 ++++-
cps/templates/index.html | 7 +++++--
cps/templates/search.html | 5 ++++-
cps/templates/shelf.html | 5 ++++-
5 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/cps/templates/author.html b/cps/templates/author.html
index 0015d6e2..fadc9a04 100644
--- a/cps/templates/author.html
+++ b/cps/templates/author.html
@@ -40,7 +40,10 @@