Adding variants and labels to entry, not yet done.

This commit is contained in:
2019-11-18 20:27:11 +01:00
parent a058a50017
commit 4bdb3bfc7f
8 changed files with 68 additions and 19 deletions

View File

@@ -32,11 +32,32 @@ class View:
h("div#entry-status", {}, entry.status),
h("div#entry-header", {}, [
h("span#headword", {}, entry.headword),
h("span#grammar", {}, entry.grammar),
h("button#comment.warning", {"on": {"click": msg(ShowCommentEdit())}}, entry.comment)]),
h("span#grammar", {}, entry.grammar)]),
View.view_entry_button_section(entry),
h("div#sense-container", {}, view_sense_list),
h("button.add-button", {"on": {"click": msg(ShowSenseAdd())}}, "+")])
@staticmethod
def view_entry_button_section(entry):
clk = lambda cls: {"on": {"click": msg(cls)}}
buttons = [
h("button.warning", clk(ShowCommentEdit()), "Comment"),
h("button.normal", clk(ShowVariantsEdit()), "Variants"),
h("button.success", clk(ShowCommentEdit()), "Labels")]
if entry.comment == "" and len(entry.labels) == 0 and len(entry.variants) == 0:
return h("div", {}, buttons)
# if entry.comment != "":
# buttons[0] = h("button.warning", clk(ShowCommentEdit()), "Comment: {}".format(entry.comment))
return h("table", {}, [
h("tr", {}, [ h("td", {}, buttons[0]), h("td", {}, entry.comment)]),
h("tr", {}, [ h("td", {}, buttons[1]), h("td", {}, ", ".join(entry.variants))]),
h("tr", {}, [ h("td", {}, buttons[2]), h("td", {}, "TODO")])])
@staticmethod
def view_sense(sense, senseNum):
examples = [View.view_example(example) for example in sense.examples]