implementing ske stuff
This commit is contained in:
@@ -129,3 +129,38 @@ def do_chosen_examples(example_list, entry):
|
||||
options.append(h("br", {}, []))
|
||||
|
||||
return modal_template(options, "Examples picker", (message.DoChosenExamples, example_list))
|
||||
|
||||
|
||||
def ske_list(search_term, data, senses, ske_kinds):
|
||||
list_contents = []
|
||||
ske_list_hidden = False
|
||||
|
||||
if data is None:
|
||||
list_contents.append(h("div.loadingspinner", {}, ""))
|
||||
elif type(data) is list:
|
||||
for line in data:
|
||||
list_contents.append(h("label.ske-line", {}, [
|
||||
h("input.ske-line-check", {"props": { "type": "checkbox" }}, ""),
|
||||
h("span.checkable", {}, line.view())]))
|
||||
elif type(data) is str:
|
||||
ske_list_hidden = True
|
||||
else:
|
||||
list_contents.append(h("span.error", {}, "Something went wrong in SKE: {}".format(data)))
|
||||
|
||||
contents = [
|
||||
h("div.flex.three", {}, [
|
||||
h("select#ske-select.third", {}, [
|
||||
h("option", {}, "{}".format(x)) for x in ske_kinds]),
|
||||
h("label.third.ske-mid-input", {}, [
|
||||
h("input#ske-search", {"props": {"value": search_term, "type": "text"}}, "")]),
|
||||
h("span.third.button.ske-right-button",
|
||||
{"on": {"click": message.msg(message.SearchInSkeModal)}}, "Isci")]),
|
||||
h("div.ske-list",
|
||||
{"style": {"visibility": "hidden" if ske_list_hidden else "visible"}},
|
||||
list_contents),
|
||||
h("div.flex.three", {}, [
|
||||
h("span.third", {}, "Vstavi v:"),
|
||||
h("select#ske-sense-select.two-third", {}, [ h("option", {}, "{} {}".format(
|
||||
idx + 1, sense.definition["indicator"])) for idx, sense in enumerate(senses)])])]
|
||||
|
||||
return modal_template(contents, "SKE", (message.SkeInsert, data))
|
||||
|
||||
Reference in New Issue
Block a user