Exporting examples, viewing logdice, frequency, clusternum

also: cluster num for example on load handled
This commit is contained in:
2020-01-24 01:49:33 +01:00
parent d843080e40
commit 7e3fa499f8
5 changed files with 114 additions and 25 deletions

View File

@@ -105,10 +105,35 @@ class View:
if example in model.chosen_examples:
example_tag += ".example-chosen"
example_html = h(example_tag, {}, [
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, [
h("span", {}, example.text())
]),
h("div.example-translation-list", {}, [
h("div.example-translation", {}, [
h("span.example-arrow", {}, ""),
vt
]) for vt in View.view_translations(example.translations, example, model)])])
cluster = example.get_cluster()
dot_attr = {"style": { "visibility": "visible" if cluster is None else "hidden"}}
example_content = []
if cluster is not None:
example_content.append(h("span.example-cluster", {}, str(cluster)))
example_content.append(h("span.example-text-inner", {}, example.text()))
if "frequency" in example.other_attributes:
example_content.append(h("span.example-frequency", {}, example.other_attributes["frequency"]))
if "logDice" in example.other_attributes:
example_content.append(h("span.example-logdice", {}, example.other_attributes["logDice"]))
return h("div.example", {}, [
h("div.example-dot", {}, ""),
h("div.example-dot", dot_attr, ""),
h(example_tag, {}, [
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, example.text()),
h("span.example-text", {"on": {"click": msg(ShowExampleMenu(example))} }, example_content),
h("div.example-translation-list", {}, [
h("div.example-translation", {}, [
h("span.example-arrow", {}, ""),