support homonymy inside modal

This commit is contained in:
matic_t
2020-07-16 03:22:54 -07:00
parent fb9a809c02
commit b010414bfe
7 changed files with 36 additions and 31 deletions

View File

@@ -51,26 +51,22 @@ def homonymy_editor(title, current_labels):
def split_line2(left, right):
cls = "flex.two{}".format(".label-list-row")
return h("div.{}".format(cls), {}, [
h("span.half", {}, left), h("span.half", {}, right)])
h("div.half", {}, left), h("div.half", {}, right)])
content = [h("p", {}, title)]
for i, feature in enumerate(current_labels()):
console.log(feature)
console.log(feature["name"])
name = [h("div", {})]
value = [h("div", {})]
name = [h("div")]
value = [h("div")]
name.append(h("label", {"attrs": {"for": i}}, "Name:"))
name.append(h("input.list-adder-input", {"props": {"type": "text", "value": feature["name"], "id": i}}, ""))
name.append(h("input.name-input", {"props": {"type": "text", "value": feature["name"], "id": i}}, ""))
value.append(h("label", {"attrs": {"for": i + "-value"}}, "Value:"))
value.append(h("input.list-adder-input", {"props": {"type": "text", "value": feature["value"], "id": i + "-value"}}, ""))
value.append(h("input.value-input", {"props": {"type": "text", "value": feature["value"], "id": i + "-value"}}, ""))
content.append(split_line2(name, value))
content.append(h("button", {"on": {"click": message.msg(message.AddToGenericList, current_labels)}}, "+"))
return content
def label_list_editor(current_labels, add_label_message_class):
console.log(current_labels)
console.log(add_label_message_class)
def split_line3(left, center, right, is_llr=True):
cls = "flex.three{}".format(".label-list-row" if is_llr else "")
return h("div.{}".format(cls), {}, [

View File

@@ -100,7 +100,6 @@ def edit_variants(entry):
def edit_homonymy(entry):
console.log(entry)
hget = lambda: entry.copy().homonymy
content = homonymy_editor("Homonymy", hget)
return modal_template(content, "Add or remove homonymy features", (message.EditHomonymy,), (message.DeleteHomonymy,))