language on explanation support + explanation as new model + homonymy refactored as a double list
This commit is contained in:
@@ -49,7 +49,7 @@ def generic_list_editor(title, element_list_getter):
|
||||
|
||||
def homonymy_editor(title, current_labels):
|
||||
def split_line2(left, right):
|
||||
cls = "flex.two{}".format(".label-list-row")
|
||||
cls = "flex.two{}".format(".double-list-row")
|
||||
return h("div.{}".format(cls), {}, [
|
||||
h("div.half", {}, left), h("div.half", {}, right)])
|
||||
|
||||
@@ -67,6 +67,28 @@ def homonymy_editor(title, current_labels):
|
||||
|
||||
return content
|
||||
|
||||
def explanation_editor(title, current_labels):
|
||||
def split_line2(left, right):
|
||||
cls = "flex.two{}".format(".double-list-row")
|
||||
return h("div.{}".format(cls), {}, [
|
||||
h("div.four-fifth", {}, left), h("div.fifth", {}, right)])
|
||||
|
||||
content = [h("p", {}, title)]
|
||||
for i, explanation in enumerate(current_labels()):
|
||||
language = []
|
||||
value = []
|
||||
language.append(h("label", {"attrs": {"for": i}}, "Language:"))
|
||||
language.append(h("input.language-input", {"props": {"type": "text", "value": explanation["language"], "id": i}}, ""))
|
||||
value.append(h("label", {"attrs": {"for": i + "-value"}}, "Value:"))
|
||||
value.append(h("input.value-input", {"props": {"type": "text", "value": explanation["value"], "id": i + "-value"}}, ""))
|
||||
|
||||
content.append(split_line2(value, language))
|
||||
content.append(h("button", {"on": {"click": message.msg(message.AddToGenericList, current_labels)}}, "+"))
|
||||
|
||||
return content
|
||||
|
||||
|
||||
|
||||
def label_list_editor(current_labels, add_label_message_class):
|
||||
def split_line3(left, center, right, is_llr=True):
|
||||
cls = "flex.three{}".format(".label-list-row" if is_llr else "")
|
||||
|
||||
@@ -21,7 +21,7 @@ def edit_translation(translation, parent, cluster_idx, num_clusters, cls):
|
||||
content.extend([
|
||||
split_line2("Prevedek:", h("textarea#etv", {"props": {"value": translation.translation}}, ""))])
|
||||
|
||||
content.extend(generic_list_editor("Razlage:", lambda: translation.explanationList))
|
||||
content.extend(explanation_editor("Razlage:", lambda: translation.explanationList))
|
||||
|
||||
# cluster number
|
||||
options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
|
||||
|
||||
Reference in New Issue
Block a user