diff --git a/src/calibre/srv/code.py b/src/calibre/srv/code.py
index 8fb41281c5..8707d57bc2 100644
--- a/src/calibre/srv/code.py
+++ b/src/calibre/srv/code.py
@@ -118,6 +118,26 @@ def get_translations():
DEFAULT_NUMBER_OF_BOOKS = 50
+def custom_list_template():
+ ans = getattr(custom_list_template, 'ans', None)
+ if ans is None:
+ ans = {
+ 'thumbnail': True,
+ 'thumbnail_height': 140,
+ 'height': 'auto',
+ 'comments_fields': ['comments'],
+ 'lines': [
+ _('{title} by {authors}'),
+ _('{series_index} of {series}') + '|||{rating}',
+ '{tags}',
+ _('Date: {timestamp}') + '|||' + _('Published: {pubdate}') + '|||' + _('Publisher: {publisher}'),
+ '',
+ ]
+ }
+ custom_list_template.ans = ans
+ return ans
+
+
def basic_interface_data(ctx, rd):
ans = {
'username': rd.username,
@@ -126,12 +146,12 @@ def basic_interface_data(ctx, rd):
for x in available_input_formats()},
'gui_pubdate_display_format': tweaks['gui_pubdate_display_format'],
'gui_timestamp_display_format': tweaks['gui_timestamp_display_format'],
- 'gui_last_modified_display_format':
- tweaks['gui_last_modified_display_format'],
+ 'gui_last_modified_display_format': tweaks['gui_last_modified_display_format'],
'use_roman_numerals_for_series_number': get_use_roman(),
'translations': get_translations(),
'icon_map': icon_map(),
'icon_path': ctx.url_for('/icon', which=''),
+ 'custom_list_template': getattr(ctx, 'custom_list_template', None) or custom_list_template(),
}
ans['library_map'], ans['default_library_id'] = ctx.library_info(rd)
return ans
diff --git a/src/pyj/book_list/custom_list.pyj b/src/pyj/book_list/custom_list.pyj
index 0ae7911dda..5605218c3c 100644
--- a/src/pyj/book_list/custom_list.pyj
+++ b/src/pyj/book_list/custom_list.pyj
@@ -6,7 +6,7 @@ from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
-from book_list.details_list import THUMBNAIL_MAX_HEIGHT, sandbox_css, BORDER_RADIUS
+from book_list.details_list import sandbox_css, BORDER_RADIUS
from book_list.library_data import library_data
from date import format_date
from dom import build_rule, clear, set_css, svgicon
@@ -15,7 +15,7 @@ from utils import fmt_sidx, safe_set_inner_html, sandboxed_html
CUSTOM_LIST_CLASS = 'book-list-custom-list'
ITEM_CLASS = CUSTOM_LIST_CLASS + '-item'
-DESCRIPTION = _('A customizable list')
+DESCRIPTION = _('A customizable list (see Preferences->Sharing over the net->Book list template)')
def custom_list_css():
ans = ''
@@ -37,10 +37,11 @@ def custom_list_css():
def default_template():
+ # Should never actually be needed
if not default_template.ans:
default_template.ans = {
'thumbnail': True,
- 'thumbnail_height': THUMBNAIL_MAX_HEIGHT,
+ 'thumbnail_height': 140,
'height': 'auto',
'comments_fields': v"['comments']",
'lines': [
@@ -263,7 +264,7 @@ def on_img_load(img, load_type):
def create_item(book_id, metadata, create_image, show_book_details):
- template = default_template()
+ template = get_interface_data().custom_list_template or default_template()
text_data = render_template_text(template, book_id, metadata)
text_data.style.flexGrow = '10'
text_data.style.overflow = 'hidden'
diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj
index 89c9d2bf10..bf04f35f37 100644
--- a/src/pyj/session.pyj
+++ b/src/pyj/session.pyj
@@ -165,6 +165,7 @@ default_interface_data = {
'library_map': None,
'icon_map': {},
'icon_path': '',
+ 'custom_list_template': None,
}
def get_interface_data():