example translations and sense translation now unified, should behave very simmilary

- import
- export
- view
- edite translation events
This commit is contained in:
2020-01-23 22:51:15 +01:00
parent b84d43bf9d
commit 513cffbbd9
9 changed files with 100 additions and 67 deletions

View File

@@ -3,20 +3,27 @@ import message
from view.modal_templates import *
def edit_translation(translation, cluster_idx, num_clusters, cls):
def split_line2(left, right):
return h("div.flex.two", {}, [
def edit_translation(translation, cluster_info, cls):
def split_line2(left, right, display):
style = {"style": {"display": "initial" if display else "none"}}
return h("div.flex.two", style, [
h("span.third.span-left-of-input", {}, left), h("span.two-third", {}, right)])
# first line: transalation itself
content = [split_line2("Prevedek:",
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, ""), True),
split_line2("Razlaga:",
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))]
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""), True)]
if cluster_info is None:
cluster_idx, num_clusters, show_cluster_options = 0, 1, False
else:
cluster_idx, num_clusters = cluster_info
show_cluster_options = True
# cluster number
options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
content.append(split_line2("Stevilka gruce:", h("select#cluster-num", {}, options)))
content.append(split_line2("Stevilka gruce:", h("select#cluster-num", {}, options), show_cluster_options))
content.append(h("h4", {}, "Tags"))
content.extend(label_list_editor(translation.copy().tags, message.AddToLabelList(translation.copy().tags)))