Finished refactoring menu showing, now also sense editing works!
This commit is contained in:
@@ -79,7 +79,7 @@ class View:
|
||||
examples = [View.view_example(example) for example in sense.examples]
|
||||
|
||||
return h("div.elm-div", {}, [
|
||||
h("div.sense-num", {}, str(senseNum + 1)),
|
||||
h("div.sense-num", {"on": {"click": msg(ShowSenseMenu(sense))}}, str(senseNum + 1)),
|
||||
h("div.sense", {}, [
|
||||
h("span.sense-label-list", { "on": { "click": msg(ShowSenseLabelEdit(sense)) }}, [
|
||||
h("span.sense-label", {}, clean_label(slabel)) for _, slabel in sense.labels ]),
|
||||
@@ -125,7 +125,7 @@ class View:
|
||||
explanation_class = ".translation-explanation" if translation.translation else ""
|
||||
elements.append(h("span{}".format(explanation_class), {}, translation.explanation))
|
||||
|
||||
return h("div.translation-div", {"on": {"click": msg(ShowMenu(translation)) }}, elements)
|
||||
return h("div.translation-div", {"on": {"click": msg(ShowTranslationMenu(translation)) }}, elements)
|
||||
|
||||
|
||||
@staticmethod
|
||||
@@ -135,9 +135,6 @@ class View:
|
||||
"top": "{}px".format(location[1])
|
||||
}
|
||||
|
||||
console.log(menu_target)
|
||||
console.log(type(menu_target))
|
||||
|
||||
if menu_target is None:
|
||||
style["opacity"] = "0"
|
||||
style["visibility"] = "hidden"
|
||||
@@ -150,6 +147,12 @@ class View:
|
||||
h("button.shyButton", { "on": {"click": msg(MoveLeft(translation))}}, "←"),
|
||||
h("button.shyButton", { "on": {"click": msg(BinTranslation(translation))}}, "🗑")])
|
||||
|
||||
elif type(menu_target) is Sense:
|
||||
sense = menu_target
|
||||
return h("span.popup-menu", { "style": style }, [
|
||||
h("button.shyButton", { "on": {"click": msg(SenseMoveUp(sense))}}, "↑"),
|
||||
h("button.shyButton", { "on": {"click": msg(SenseMoveDown(sense))}}, "↓"),
|
||||
h("button.shyButton", { "on": {"click": msg(SenseBin(sense))}}, "🗑")])
|
||||
else:
|
||||
console.log("Should not be heree!!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user