mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make rating clickable in the book details page
This commit is contained in:
parent
f758320251
commit
be0ed348fd
@ -170,15 +170,19 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
|||||||
fields = filter(allowed_fields, fields)
|
fields = filter(allowed_fields, fields)
|
||||||
comments = v'[]'
|
comments = v'[]'
|
||||||
|
|
||||||
def add_row(name, val, is_searchable=False, is_html=False, join=None):
|
def add_row(name, val, is_searchable=False, is_html=False, join=None, search_text=None):
|
||||||
if val is undefined or val is None:
|
if val is undefined or val is None:
|
||||||
return
|
return
|
||||||
def add_val(v):
|
def add_val(v):
|
||||||
if not v.appendChild:
|
if not v.appendChild:
|
||||||
v += ''
|
v += ''
|
||||||
if is_searchable:
|
if is_searchable:
|
||||||
|
text_rep = search_text or v
|
||||||
table.lastChild.lastChild.appendChild(E.a(
|
table.lastChild.lastChild.appendChild(E.a(
|
||||||
title=_('Click to see books with {0}: {1}').format(name, v), class_='blue-link', href=href_for_search(is_searchable, v), v))
|
v,
|
||||||
|
title=_('Click to see books with {0}: {1}').format(name, text_rep), class_='blue-link',
|
||||||
|
href=href_for_search(is_searchable, text_rep)
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
if v.appendChild:
|
if v.appendChild:
|
||||||
table.lastChild.lastChild.appendChild(v)
|
table.lastChild.lastChild.appendChild(v)
|
||||||
@ -233,7 +237,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
|||||||
val = int(val or 0)
|
val = int(val or 0)
|
||||||
if val > 0:
|
if val > 0:
|
||||||
add_stars_to(stars, val, fm.display?.allow_half_stars)
|
add_stars_to(stars, val, fm.display?.allow_half_stars)
|
||||||
add_row(name, stars)
|
add_row(name, stars, is_searchable=field, search_text=val/2 + '')
|
||||||
|
|
||||||
def process_identifiers(field, fm, name, val):
|
def process_identifiers(field, fm, name, val):
|
||||||
if val:
|
if val:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user