From d5201ff24d1ee873da1e3eca7c896c0d8920090c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Feb 2022 18:28:15 +0530 Subject: [PATCH] Fix #1960227 [[Enhancement - Content server] Don't display arrows on the cover on the Book details page if there are no previous/next book](https://bugs.launchpad.net/calibre/+bug/1960227) --- src/pyj/book_list/book_details.pyj | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index fb4c0f423a..d7a49f0cd1 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -513,12 +513,17 @@ def render_book(container_id, book_id): button_style += 'display: none;' def prev_next_button(is_prev): + delta = -1 if is_prev else 1 + nbid = book_after(book_id, delta) + s = button_style + if not nbid or nbid is book_id: + s += '; display: none' return E.div( - style=button_style, + style=s, title=_('Previous book [Ctrl+Left]') if is_prev else _('Next book [Ctrl+Right]'), class_='next-book-button', svgicon('chevron-left' if is_prev else 'chevron-right'), - onclick=next_book.bind(None, book_id, (-1 if is_prev else 1)) + onclick=next_book.bind(None, book_id, delta) ) imgdiv = E.div(style='position: relative',