mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
NO_SEARCH_LINK should generate no link in the content server as well
This commit is contained in:
parent
6b4035b84f
commit
cc19aa0ae6
@ -15,7 +15,7 @@ DATA_FILE_PATTERN = f'{DATA_DIR_NAME}/**/*'
|
||||
BOOK_ID_PATH_TEMPLATE = ' ({})'
|
||||
RESOURCE_URL_SCHEME = 'calres'
|
||||
TEMPLATE_ICON_INDICATOR = ' template ' # Item values cannot start or end with space
|
||||
NO_SEARCH_LINK = '*no_link*'
|
||||
NO_SEARCH_LINK = '__no_link__'
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -14,7 +14,6 @@ from threading import Lock
|
||||
from calibre import as_unicode
|
||||
from calibre.constants import in_develop_mode
|
||||
from calibre.customize.ui import available_input_formats
|
||||
from calibre.db.constants import NO_SEARCH_LINK
|
||||
from calibre.db.view import sanitize_sort_field_name
|
||||
from calibre.ebooks.metadata.book.render import resolve_default_author_link
|
||||
from calibre.srv.ajax import search_result
|
||||
@ -176,8 +175,6 @@ def basic_interface_data(ctx, rd):
|
||||
'lang_code_for_user_manual': lang_code_for_user_manual(),
|
||||
'default_author_link': resolve_default_author_link(get_gpref('default_author_link')),
|
||||
}
|
||||
if ans['default_author_link'] == NO_SEARCH_LINK:
|
||||
ans['default_author_link'] = ''
|
||||
ans['library_map'], ans['default_library_id'] = ctx.library_info(rd)
|
||||
if ans['username']:
|
||||
ans['recently_read_by_user'] = tuple(
|
||||
|
@ -434,6 +434,7 @@ def run_rapydscript_tests():
|
||||
|
||||
|
||||
def set_data(src, **kw):
|
||||
from calibre.db.constants import NO_SEARCH_LINK
|
||||
for k, v in {
|
||||
'__SPECIAL_TITLE__': SPECIAL_TITLE_FOR_WEBENGINE_COMMS,
|
||||
'__FAKE_PROTOCOL__': FAKE_PROTOCOL,
|
||||
@ -442,7 +443,8 @@ def set_data(src, **kw):
|
||||
'__DARK_LINK_COLOR__': dark_link_color,
|
||||
'__BUILTIN_COLORS_LIGHT__': json.dumps(builtin_colors_light),
|
||||
'__BUILTIN_COLORS_DARK__': json.dumps(builtin_colors_dark),
|
||||
'__BUILTIN_DECORATIONS__': json.dumps(builtin_decorations)
|
||||
'__BUILTIN_DECORATIONS__': json.dumps(builtin_decorations),
|
||||
'__NO_SEARCH_LINK__': NO_SEARCH_LINK,
|
||||
}.items():
|
||||
src = src.replace(k, v, 1)
|
||||
for k, v in kw.items():
|
||||
|
@ -287,7 +287,9 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
||||
parent = table.lastChild.lastChild
|
||||
if is_searchable:
|
||||
websearch_link = False
|
||||
no_link = False
|
||||
if field is 'authors':
|
||||
no_link = interface_data.default_author_link is '__NO_SEARCH_LINK__'
|
||||
websearch_link = bool(interface_data.default_author_link) and interface_data.default_author_link is not 'search-calibre'
|
||||
else:
|
||||
fm = field_metadata[field]
|
||||
@ -306,22 +308,22 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
|
||||
else:
|
||||
url = calibre_search_url
|
||||
tooltip = calibre_search_tooltip
|
||||
parent.appendChild(E.a(v, target=target, title=tooltip, class_='blue-link', href=url))
|
||||
if no_link:
|
||||
parent.appendChild(v if v.appendChild else document.createTextNode(v))
|
||||
else:
|
||||
parent.appendChild(E.a(v, target=target, title=tooltip, class_='blue-link', href=url))
|
||||
if link_maps[field] and link_maps[field][text_rep]:
|
||||
url = link_maps[field][text_rep]
|
||||
if url.startswith('https://') or url.startswith('http://'):
|
||||
parent.appendChild(document.createTextNode(' '))
|
||||
parent.appendChild(E.a(
|
||||
svgicon('external-link'), title=_('Click to open') + ': ' + url, href=url, target='_blank', class_='blue-link'))
|
||||
if websearch_link:
|
||||
if websearch_link or no_link:
|
||||
parent.appendChild(document.createTextNode(' '))
|
||||
parent.appendChild(E.a(
|
||||
svgicon('search'), title=calibre_search_tooltip, href=calibre_search_url, class_='blue-link'))
|
||||
else:
|
||||
if v.appendChild:
|
||||
parent.appendChild(v)
|
||||
else:
|
||||
parent.appendChild(document.createTextNode(v))
|
||||
parent.appendChild(v if v.appendChild else document.createTextNode(v))
|
||||
if jstype(v) is 'string' and not is_html:
|
||||
add_note_link(field, name, v, parent)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user