Content server: Allow clicking on book cover in details page to read the book. Fixes #1819058 [[Feature] Clicking on cover in book details to read it](https://bugs.launchpad.net/calibre/+bug/1819058)

This commit is contained in:
Kovid Goyal 2019-03-08 10:15:56 +05:30
parent 99e8bdd227
commit 7d9f51cd9e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -436,11 +436,12 @@ def render_book(container_id, book_id):
render_book.title = metadata.title render_book.title = metadata.title
set_title(c, metadata.title) set_title(c, metadata.title)
authors = metadata.authors.join(' & ') if metadata.authors else _('Unknown') authors = metadata.authors.join(' & ') if metadata.authors else _('Unknown')
alt = _('{} by {}').format(metadata.title, authors) alt = _('{} by {}\nClick to read').format(metadata.title, authors)
imgdiv = E.div( imgdiv = E.div(
E.img( E.img(
alt=alt, title=alt, data_title=metadata.title, data_authors=authors, alt=alt, title=alt, data_title=metadata.title, data_authors=authors,
style='border-radius: 20px; max-width: calc(100vw - 2em); max-height: calc(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: 20px'.format(get_font_size('title') onclick=read_book.bind(None, book_id),
style='cursor: pointer; border-radius: 20px; max-width: calc(100vw - 2em); max-height: calc(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: 20px'.format(get_font_size('title')
)) ))
) )
imgdiv.firstChild.onerror = on_img_err imgdiv.firstChild.onerror = on_img_err