Example move up, down, bin via menu.

This commit is contained in:
2020-01-23 23:10:39 +01:00
parent 513cffbbd9
commit 420f48634d
6 changed files with 53 additions and 10 deletions

View File

@@ -38,9 +38,6 @@ def edit_sense_label(sense):
def edit_example(example):
content = question("Edit example", example.text)
etl_getter = lambda: example.copy().translations
content.extend(generic_list_editor("Edit example translations", etl_getter))
return modal_template(content, "Edit Example", message.EditExampleTranslation(example))

View File

@@ -106,9 +106,9 @@ class View:
example_tag += ".example-chosen"
return h("div.example", {}, [
h("div.example-dot", {"on": {"click": msg(ShowExampleMenu(example))} }, ""),
h("div.example-dot", {}, ""),
h(example_tag, {}, [
h("span.example-text", {"on": {"click": msg(ShowExampleEdit(example))}}, example.text),
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, example.text),
h("div.example-translation-list", {}, [
h("div.example-translation", {}, [
h("span.example-arrow", {}, ""),
@@ -171,10 +171,12 @@ class View:
h("button.shyButton", { "on": {"click": msg(SenseBin(sense))}}, "🗑")])
elif type(menu_target) is Example:
example = menu_target
return h("span.popup-menu", { "style": style }, [
h("button.shyButton", {}, "a"),
h("button.shyButton", {}, "b"),
h("button.shyButton", {}, "🗑")])
h("button.shyButton", { "on": {"click": msg(ShowExampleEdit(example))}}, ""),
h("button.shyButton", { "on": {"click": msg(ExampleMoveUp(example))}}, ""),
h("button.shyButton", { "on": {"click": msg(ExampleMoveDown(example))}}, ""),
h("button.shyButton", { "on": {"click": msg(ExampleBin(example))}}, "🗑")])
else:
console.log("Should not be heree!!")