mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pass bools_are_tristate to content server interface
This commit is contained in:
parent
02cd4a3c06
commit
6322ba9a1b
@ -207,6 +207,7 @@ def get_library_init_data(ctx, rd, db, num, sorts, orders, vl):
|
||||
)
|
||||
ans['field_metadata'] = db.field_metadata.all_metadata()
|
||||
ans['virtual_libraries'] = db._pref('virtual_libraries', {})
|
||||
ans['bools_are_tristate'] = db._pref('bools_are_tristate', True)
|
||||
ans['book_display_fields'] = get_field_list(db)
|
||||
mdata = ans['metadata'] = {}
|
||||
try:
|
||||
|
@ -382,8 +382,10 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
||||
join = fm.is_multiple.list_to_ui if fm.is_multiple else None
|
||||
add_row(name, val, join=join, is_searchable=field)
|
||||
elif datatype is 'bool':
|
||||
# We are missing checking if the pref bools_are_tristate is False
|
||||
v = _('Yes') if val else ('' if val is undefined or val is None else _('No'))
|
||||
if library_data.bools_are_tristate:
|
||||
v = _('Yes') if val else ('' if val is undefined or val is None else _('No'))
|
||||
else:
|
||||
v = _('Yes') if val else _('No')
|
||||
if v:
|
||||
add_row(name, v, is_searchable=field, use_quotes=False)
|
||||
elif datatype is 'int' or datatype is 'float':
|
||||
|
@ -11,7 +11,7 @@ from session import get_interface_data
|
||||
from utils import parse_url_params
|
||||
|
||||
load_status = {'loading':True, 'ok':False, 'error_html':None, 'current_fetch': None, 'http_error_code': 0}
|
||||
library_data = {'metadata':{}, 'previous_book_ids': v'[]', 'force_refresh': False}
|
||||
library_data = {'metadata':{}, 'previous_book_ids': v'[]', 'force_refresh': False, 'bools_are_tristate': True}
|
||||
|
||||
|
||||
def current_library_id():
|
||||
@ -83,7 +83,7 @@ def update_library_data(data):
|
||||
if library_data.for_library is not current_library_id():
|
||||
library_data.field_names = {}
|
||||
library_data.for_library = current_library_id()
|
||||
for key in 'search_result sortable_fields field_metadata metadata virtual_libraries book_display_fields'.split(' '):
|
||||
for key in 'search_result sortable_fields field_metadata metadata virtual_libraries book_display_fields bools_are_tristate'.split(' '):
|
||||
library_data[key] = data[key]
|
||||
sr = library_data.search_result
|
||||
if sr:
|
||||
|
Loading…
x
Reference in New Issue
Block a user