mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix adding to search broken accidentally during port
This commit is contained in:
parent
ee3f47fdd2
commit
2d33efb299
@ -156,14 +156,15 @@ def add_to_search(node, search_type, anded):
|
|||||||
render_search_expression()
|
render_search_expression()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_expression(node_id):
|
||||||
|
v'delete state.active_nodes[node_id]'
|
||||||
|
render_search_expression()
|
||||||
|
|
||||||
|
|
||||||
def render_search_expression():
|
def render_search_expression():
|
||||||
def remove_expression(node_id):
|
parts = v'[]'
|
||||||
return def():
|
|
||||||
v'delete state.active_nodes[node_id]'
|
|
||||||
render_search_expression()
|
|
||||||
parts = []
|
|
||||||
container = document.getElementById(state.container_id)
|
container = document.getElementById(state.container_id)
|
||||||
sic = component(container, 'tag_browser')
|
sic = component(container, 'search_expression')
|
||||||
clear(sic)
|
clear(sic)
|
||||||
for node_id in Object.keys(state.active_nodes):
|
for node_id in Object.keys(state.active_nodes):
|
||||||
search_type, anded = state.active_nodes[node_id]
|
search_type, anded = state.active_nodes[node_id]
|
||||||
@ -173,7 +174,7 @@ def render_search_expression():
|
|||||||
if expr:
|
if expr:
|
||||||
c = E.li(svgicon('remove'), '\xa0' + name)
|
c = E.li(svgicon('remove'), '\xa0' + name)
|
||||||
sic.appendChild(c)
|
sic.appendChild(c)
|
||||||
c.addEventListener('click', remove_expression(node_id))
|
c.addEventListener('click', remove_expression.bind(None, node_id))
|
||||||
if parts.length:
|
if parts.length:
|
||||||
expr = ('and' if anded else 'or') + ' ' + expr
|
expr = ('and' if anded else 'or') + ' ' + expr
|
||||||
parts.push(expr)
|
parts.push(expr)
|
||||||
@ -183,10 +184,6 @@ def render_search_expression():
|
|||||||
|
|
||||||
def menu_clicked(i):
|
def menu_clicked(i):
|
||||||
|
|
||||||
def add_to_search(node, search_type):
|
|
||||||
return def():
|
|
||||||
add_to_search(node, search_type)
|
|
||||||
|
|
||||||
def create_details(container, hide_modal):
|
def create_details(container, hide_modal):
|
||||||
node = node_for_path().children[i]
|
node = node_for_path().children[i]
|
||||||
data = node.data
|
data = node.data
|
||||||
@ -229,7 +226,7 @@ def menu_clicked(i):
|
|||||||
E.img(src='{}/{}.png'.format(interface_data.icon_path, search_type), style='max-height: 2.5ex'),
|
E.img(src='{}/{}.png'.format(interface_data.icon_path, search_type), style='max-height: 2.5ex'),
|
||||||
E.span('\xa0' + text)
|
E.span('\xa0' + text)
|
||||||
)
|
)
|
||||||
li.addEventListener('click', add_to_search(node, search_type))
|
li.addEventListener('click', add_to_search.bind(None, node, search_type))
|
||||||
li.addEventListener('click', hide_modal)
|
li.addEventListener('click', hide_modal)
|
||||||
ul.appendChild(li)
|
ul.appendChild(li)
|
||||||
f = E.form(
|
f = E.form(
|
||||||
@ -391,7 +388,7 @@ def create_search_panel(container):
|
|||||||
search_bar = create_search_bar(execute_search, 'search-books', tooltip=_('Search for books'), placeholder=_('Enter the search query'), button=search_button)
|
search_bar = create_search_bar(execute_search, 'search-books', tooltip=_('Search for books'), placeholder=_('Enter the search query'), button=search_button)
|
||||||
set_css(search_bar, flex_grow='10', margin_right='0.5em')
|
set_css(search_bar, flex_grow='10', margin_right='0.5em')
|
||||||
search_container.appendChild(E.div(style="display: flex; width: 100%;", search_bar, search_button))
|
search_container.appendChild(E.div(style="display: flex; width: 100%;", search_bar, search_button))
|
||||||
search_container.appendChild(E.ul(class_='search-items'))
|
search_container.appendChild(E.ul(class_='search-items', data_component='search_expression'))
|
||||||
|
|
||||||
# Build loading panel
|
# Build loading panel
|
||||||
loading_panel = component(container, 'loading')
|
loading_panel = component(container, 'loading')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user