editing example texts now as I see it could look like.
This commit is contained in:
@@ -37,8 +37,40 @@ def edit_sense_label(sense):
|
||||
|
||||
|
||||
def edit_example(example):
|
||||
content = question("Edit example", example.text())
|
||||
return modal_template(content, "Edit Example", message.EditExampleTranslation(example))
|
||||
example_original = example
|
||||
example = example_original.copy()
|
||||
|
||||
def role_msg(idx, role):
|
||||
return message.msg(message.ExampleRoleChange(example_original, idx, role))
|
||||
|
||||
divs = []
|
||||
buttons_right = lambda idx: [
|
||||
h("span.example-component-button.example-component-headword",
|
||||
{"on": {"click": role_msg(idx, "headword")}}, "■"),
|
||||
h("span.example-component-button.example-component-collocate",
|
||||
{"on": {"click": role_msg(idx, "collocate")}}, "■"),
|
||||
h("span.example-component-button.example-component-other",
|
||||
{"on": {"click": role_msg(idx, "other")}}, "■"),
|
||||
h("span.example-component-button.example-component-none",
|
||||
{"on": {"click": role_msg(idx, "none")}}, "■"),
|
||||
h("span.example-component-button",
|
||||
{"on": {"click": message.msg(message.ExampleComponentAdd(example_original, idx))}}, "+"),
|
||||
h("span.example-component-button",
|
||||
{"on": {"click": message.msg(message.ExampleComponentRemove(example_original, idx))}}, "-")]
|
||||
|
||||
for idx, component in enumerate(example.components):
|
||||
role_txt = component.role if component.role is not None else "none"
|
||||
color_class = ".example-component-" + role_txt
|
||||
|
||||
left = [h("span" + color_class, {}, role_txt)]
|
||||
middle = [h("input.example-component-text", {"props": {"type": "text", "value": component.text}}, "")]
|
||||
|
||||
divs.append(h("div.flex.five.example-component", {}, [
|
||||
h("div.one-fifth", {}, left),
|
||||
h("div.three-fifth", {}, middle),
|
||||
h("div.one-fifth", {}, buttons_right(idx))]))
|
||||
|
||||
return modal_template(divs, "Edit Example", message.EditExampleText(example_original))
|
||||
|
||||
|
||||
def edit_variants(entry):
|
||||
|
||||
Reference in New Issue
Block a user