title of translation parent when editing example translation
This commit is contained in:
parent
81f3b4336a
commit
3299a34226
|
@ -316,6 +316,10 @@
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
span.translation-original span {
|
||||||
|
margin-right: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-menu {
|
.popup-menu {
|
||||||
// DONE!
|
// DONE!
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -55,17 +55,18 @@ class ShowEditTranslation(ClickMessage):
|
||||||
translation.make_copy()
|
translation.make_copy()
|
||||||
num_clusters = len(parent.translations)
|
num_clusters = len(parent.translations)
|
||||||
model.modal_set(lambda: modals.edit_translation(
|
model.modal_set(lambda: modals.edit_translation(
|
||||||
translation, cidx, num_clusters, (EditTranslation, translation, cidx)))
|
translation, parent, cidx, num_clusters, (EditTranslation, translation, cidx)))
|
||||||
|
|
||||||
|
|
||||||
class ShowAddTranslation(ClickMessage):
|
class ShowAddTranslation(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
chosen_sense_or_example = self.get_arg(0)
|
chosen_sense_or_example = self.get_arg(0)
|
||||||
|
|
||||||
translation = Translation()
|
translation = Translation()
|
||||||
|
|
||||||
translation.make_copy()
|
translation.make_copy()
|
||||||
model.modal_set(lambda: modals.edit_translation(
|
model.modal_set(lambda: modals.edit_translation(
|
||||||
translation,
|
translation,
|
||||||
|
chosen_sense_or_example,
|
||||||
-1,
|
-1,
|
||||||
len(chosen_sense_or_example.translations),
|
len(chosen_sense_or_example.translations),
|
||||||
(AddTranslation, translation, -1, chosen_sense_or_example)))
|
(AddTranslation, translation, -1, chosen_sense_or_example)))
|
||||||
|
|
|
@ -81,6 +81,9 @@ class Example(Data):
|
||||||
h("div.example-translation", {}, View.view_translations(self.translations, self, model))]),
|
h("div.example-translation", {}, View.view_translations(self.translations, self, model))]),
|
||||||
h("div.example-clusters",
|
h("div.example-clusters",
|
||||||
{"style": {"display": clusters_display }}, show_toggle_cluster_buttons(sense, self))])])
|
{"style": {"display": clusters_display }}, show_toggle_cluster_buttons(sense, self))])])
|
||||||
|
|
||||||
|
def simple_view(self):
|
||||||
|
return self.inner.view(self.components)
|
||||||
|
|
||||||
def get_cluster(self):
|
def get_cluster(self):
|
||||||
return self.inner.get_cluster()
|
return self.inner.get_cluster()
|
||||||
|
|
|
@ -2,18 +2,27 @@ from lib.snabbdom import h
|
||||||
import message
|
import message
|
||||||
from view.modal_templates import *
|
from view.modal_templates import *
|
||||||
from view.utils import show_toggle_cluster_buttons
|
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):
|
def split_line2(left, right):
|
||||||
return h("div.flex.two", {}, [
|
return h("div.flex.two", {}, [
|
||||||
h("span.third.span-left-of-input", {}, left), h("span.two-third", {}, right)])
|
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
|
# first line: transalation itself
|
||||||
content = [split_line2("Prevedek:",
|
content.extend([
|
||||||
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
|
split_line2("Prevedek:",
|
||||||
split_line2("Razlaga:",
|
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
|
||||||
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))]
|
split_line2("Razlaga:",
|
||||||
|
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))])
|
||||||
|
|
||||||
# cluster number
|
# cluster number
|
||||||
options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
|
options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user