Fix #1954890 [[Feature Request] Content Server: Search results with number of items found](https://bugs.launchpad.net/calibre/+bug/1954890)

This commit is contained in:
Kovid Goyal 2022-01-19 11:04:16 +05:30
parent 23fe52192b
commit f689517d1a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -250,13 +250,14 @@ def show_top_message():
if q.search:
container.appendChild(E.br())
if q.search:
text = _('Showing books matching: {} ')
if not library_data.search_result.total_num:
text = _('No books matching: {} ')
container.appendChild(E.span(
E.span(text.format(library_data.search_result.query)),
create_button(_('Clear'), 'close', def(): search();, _('Clear this search'))
))
c = E.span()
if library_data.search_result.total_num:
c.appendChild(E.span(_('Showing books matching:'), ' ', E.i(library_data.search_result.query), ' ', _('(total matches: {}) ').format(library_data.search_result.total_num)))
c.appendChild(E.span(' ', E.a(_('Clear search'), class_='blue-link', onclick=def(): search();)))
else:
c.appendChild(E.span(_('No books matching:'), ' ', E.i(library_data.search_result.query)))
container.appendChild(c)
def create_books_list(container):
book_list_data.container_id = ensure_id(container)