mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Display custom comments field on the book details page in the same order as in the calibre GUI
This commit is contained in:
parent
396af5fe81
commit
43242d4f1e
@ -158,7 +158,7 @@ def render_metadata(mi, table, book_id): # {{{
|
|||||||
fields = sorted(filter(allowed_fields, mi), key=field_sorter(field_metadata))
|
fields = sorted(filter(allowed_fields, mi), key=field_sorter(field_metadata))
|
||||||
else:
|
else:
|
||||||
fields = filter(allowed_fields, fields)
|
fields = filter(allowed_fields, fields)
|
||||||
comments = {}
|
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):
|
||||||
if val is undefined or val is None:
|
if val is undefined or val is None:
|
||||||
@ -302,7 +302,7 @@ def render_metadata(mi, table, book_id): # {{{
|
|||||||
return
|
return
|
||||||
if hp is 'above':
|
if hp is 'above':
|
||||||
val = E.h3(name).outerHTML + val
|
val = E.h3(name).outerHTML + val
|
||||||
comments[field] = val
|
comments.push(v'[field, val]')
|
||||||
return
|
return
|
||||||
func = None
|
func = None
|
||||||
if datatype is 'composite':
|
if datatype is 'composite':
|
||||||
@ -352,10 +352,9 @@ def render_metadata(mi, table, book_id): # {{{
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
all_html = ''
|
all_html = ''
|
||||||
for i, field in enumerate(sorted(comments)):
|
for field, comment in comments:
|
||||||
fm = field_metadata[field]
|
|
||||||
comment = comments[field]
|
|
||||||
if comment:
|
if comment:
|
||||||
|
fm = field_metadata[field]
|
||||||
if fm.display?.heading_position is 'above':
|
if fm.display?.heading_position is 'above':
|
||||||
name = fm.name or field
|
name = fm.name or field
|
||||||
all_html += f'<h3>{name}</h3>'
|
all_html += f'<h3>{name}</h3>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user