ShowExampleEdit becomes more complex, handles ctrl+click and selecting/moving examples

This commit is contained in:
2020-01-02 14:22:35 +01:00
parent 00827e7b0b
commit e7283c3ba1
5 changed files with 50 additions and 6 deletions

View File

@@ -29,7 +29,6 @@ def edit_sense_label(sense):
return modal_template(content, "Translation", message.EditSenseLabel(sense))
def edit_example_translation(example):
etl_getter = lambda: example.copy().translations
content = generic_list_editor("Edit example translations", etl_getter)
@@ -57,3 +56,16 @@ def edit_comment(comment):
def edit_example(example):
return modal_template(question("Edit exmample", example.example), "Example", message.EditExample(example))
def do_chosen_examples(example_list, entry):
options = []
for sense in entry.senses:
options.append(h("option", {}, sense.merge_labels()))
content = [
h("span", {}, "Choose sense for examples"),
h("label", {}, [
h("select#chosen-examples-select", {}, options)])]
return modal_template(content, "Examples picker", message.DoChosenExamples(example_list))