|
|
@ -34,17 +34,28 @@ class View:
|
|
|
|
def view_entry(entry, model):
|
|
|
|
def view_entry(entry, model):
|
|
|
|
view_sense_list = [View.view_sense(sense, idx, model) for idx, sense in enumerate(entry.senses)]
|
|
|
|
view_sense_list = [View.view_sense(sense, idx, model) for idx, sense in enumerate(entry.senses)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buttons_left = View.view_entry_button_section(entry, model)
|
|
|
|
|
|
|
|
buttons_right = View.view_toggle_buttons(model)
|
|
|
|
|
|
|
|
|
|
|
|
return h("div#entry", {}, [
|
|
|
|
return h("div#entry", {}, [
|
|
|
|
h("div#entry-status", {}, entry.status),
|
|
|
|
h("div#entry-status", {}, entry.status),
|
|
|
|
h("div#entry-header", {}, [
|
|
|
|
h("div#entry-header", {}, [
|
|
|
|
h("span#headword", {}, entry.headword),
|
|
|
|
h("span#headword", {}, entry.headword),
|
|
|
|
h("span#grammar", {}, entry.grammar),
|
|
|
|
h("span#grammar", {}, entry.grammar),
|
|
|
|
h("span#measure", {}, entry.get_measure_text())]),
|
|
|
|
h("span#measure", {}, entry.get_measure_text())]),
|
|
|
|
View.view_entry_button_section(entry, model),
|
|
|
|
h("div.flex.five", {}, [
|
|
|
|
|
|
|
|
h("div.four-fifth", {}, buttons_left),
|
|
|
|
|
|
|
|
h("div.one-fifth", {}, buttons_right)]),
|
|
|
|
h("div#sense-container", {}, view_sense_list),
|
|
|
|
h("div#sense-container", {}, view_sense_list),
|
|
|
|
h("button.add-button", {"on": {"click": msg(AddSense())}}, "+")])
|
|
|
|
h("button.add-button", {"on": {"click": msg(AddSense())}}, "+")])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def view_toggle_buttons(model):
|
|
|
|
|
|
|
|
txt = "Hide examples" if model.examples_shown else "Show examples"
|
|
|
|
|
|
|
|
return [ h("span.button.toggle", {"on": {"click": msg(ToggleExamples())}}, txt) ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def view_entry_button_section(entry, model):
|
|
|
|
def view_entry_button_section(entry, model):
|
|
|
|
clk = lambda cls: {"on": {"click": msg(cls)}}
|
|
|
|
clk = lambda cls: {"on": {"click": msg(cls)}}
|
|
|
@ -130,7 +141,11 @@ class View:
|
|
|
|
if "logDice" in example.other_attributes:
|
|
|
|
if "logDice" in example.other_attributes:
|
|
|
|
example_content.append(h("span.example-logdice", {}, example.other_attributes["logDice"]))
|
|
|
|
example_content.append(h("span.example-logdice", {}, example.other_attributes["logDice"]))
|
|
|
|
|
|
|
|
|
|
|
|
return h("div.example", {}, [
|
|
|
|
parent_display = "inherit"
|
|
|
|
|
|
|
|
if not model.examples_shown and not example.is_collocation():
|
|
|
|
|
|
|
|
parent_display = "none"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return h("div.example", {"style": {"display": parent_display}}, [
|
|
|
|
h("div.example-dot", dot_attr, "▣"),
|
|
|
|
h("div.example-dot", dot_attr, "▣"),
|
|
|
|
h(example_tag, {}, [
|
|
|
|
h(example_tag, {}, [
|
|
|
|
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, example_content),
|
|
|
|
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, example_content),
|
|
|
|