|
|
|
@ -2,18 +2,27 @@ from lib.snabbdom import h
|
|
|
|
|
import message
|
|
|
|
|
from view.modal_templates import *
|
|
|
|
|
from view.utils import show_toggle_cluster_buttons
|
|
|
|
|
import model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def edit_translation(translation, cluster_idx, num_clusters, cls):
|
|
|
|
|
def edit_translation(translation, parent, cluster_idx, num_clusters, cls):
|
|
|
|
|
def split_line2(left, right):
|
|
|
|
|
return h("div.flex.two", {}, [
|
|
|
|
|
h("span.third.span-left-of-input", {}, left), h("span.two-third", {}, right)])
|
|
|
|
|
|
|
|
|
|
content = []
|
|
|
|
|
if type(parent) is model.Example:
|
|
|
|
|
content.extend([
|
|
|
|
|
h("span.translation-original-title", {}, "Primer: "),
|
|
|
|
|
h("span.translation-original", {}, parent.simple_view()),
|
|
|
|
|
h("hr", {}, None)])
|
|
|
|
|
|
|
|
|
|
# first line: transalation itself
|
|
|
|
|
content = [split_line2("Prevedek:",
|
|
|
|
|
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
|
|
|
|
|
split_line2("Razlaga:",
|
|
|
|
|
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))]
|
|
|
|
|
content.extend([
|
|
|
|
|
split_line2("Prevedek:",
|
|
|
|
|
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
|
|
|
|
|
split_line2("Razlaga:",
|
|
|
|
|
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))])
|
|
|
|
|
|
|
|
|
|
# cluster number
|
|
|
|
|
options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
|
|
|
|
|