mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1904363 [[Enhancement - Content server] Show size as MB in the Book details page](https://bugs.launchpad.net/calibre/+bug/1904363)
This commit is contained in:
parent
4bafec703d
commit
3d89c98110
@ -29,6 +29,7 @@ from utils import (
|
|||||||
safe_set_inner_html, sandboxed_html
|
safe_set_inner_html, sandboxed_html
|
||||||
)
|
)
|
||||||
from widgets import create_button, create_spinner
|
from widgets import create_button, create_spinner
|
||||||
|
from utils import human_readable
|
||||||
|
|
||||||
bd_counter = 0
|
bd_counter = 0
|
||||||
|
|
||||||
@ -255,6 +256,13 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
|||||||
if td.childNodes.length:
|
if td.childNodes.length:
|
||||||
table.appendChild(E.tr(E.td(name + ':'), td))
|
table.appendChild(E.tr(E.td(name + ':'), td))
|
||||||
|
|
||||||
|
def process_size(field, fm, name, val):
|
||||||
|
if val:
|
||||||
|
try:
|
||||||
|
add_row(name, human_readable(int(val)))
|
||||||
|
except:
|
||||||
|
add_row(name, val+'')
|
||||||
|
|
||||||
def process_languages(field, fm, name, val):
|
def process_languages(field, fm, name, val):
|
||||||
if val and val.length:
|
if val and val.length:
|
||||||
table.appendChild(E.tr(E.td(name + ':'), E.td()))
|
table.appendChild(E.tr(E.td(name + ':'), E.td()))
|
||||||
@ -341,6 +349,8 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
|||||||
func = process_publisher
|
func = process_publisher
|
||||||
elif field is 'languages':
|
elif field is 'languages':
|
||||||
func = process_languages
|
func = process_languages
|
||||||
|
elif field is 'size':
|
||||||
|
func = process_size
|
||||||
elif datatype is 'datetime':
|
elif datatype is 'datetime':
|
||||||
func = process_datetime
|
func = process_datetime
|
||||||
elif datatype is 'series':
|
elif datatype is 'series':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user