|
|
|
@ -1,27 +1,7 @@
|
|
|
|
|
from lib.snabbdom import h
|
|
|
|
|
import message
|
|
|
|
|
from browser import document
|
|
|
|
|
from model.translation import TAGS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def modal_template(content, title, msg, prop):
|
|
|
|
|
reset = message.msg(message.ModalNotOkClose)
|
|
|
|
|
return [
|
|
|
|
|
h("header", {}, [
|
|
|
|
|
h("h3", {}, title),
|
|
|
|
|
h("label.close", {"on": {"click": reset}}, "×")]),
|
|
|
|
|
h("section.content", {}, content ),
|
|
|
|
|
h("footer", {}, [
|
|
|
|
|
h("a.button", {"on": {"click": message.msg(msg, prop)}}, "OK"),
|
|
|
|
|
h("label.button.dangerous", {"on": {"click": reset}}, "Cancel")])]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def one_question_modal(title, msg, question, current_value, prop):
|
|
|
|
|
content = [
|
|
|
|
|
h("span", {}, question),
|
|
|
|
|
h("label", {}, [
|
|
|
|
|
h("input#modal-input", {"props": {"type": "text", "value": current_value}}, "")])]
|
|
|
|
|
return modal_template(content, title, msg, prop)
|
|
|
|
|
from view.modal_templates import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def edit_translation(translation, cluster_idx, num_clusters, cls, prop):
|
|
|
|
@ -82,12 +62,8 @@ def edit_sense_label(sense):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def edit_example_translation(example):
|
|
|
|
|
content = [h("span", {}, "Edit example translations")]
|
|
|
|
|
for slabel in example.copy().translations:
|
|
|
|
|
content.append(h("label", {}, [
|
|
|
|
|
h("input.example-translation-edit-input", {"props": {"type": "text", "value": slabel}}, "")]))
|
|
|
|
|
|
|
|
|
|
content.append(h("button", {"on": {"click": message.msg(message.AddExampleTranslation, example)}}, "+"))
|
|
|
|
|
etl_getter = lambda: example.copy().translations
|
|
|
|
|
content = list_adder("Edit example translations", etl_getter, message.msg(message.AddExampleTranslation, example))
|
|
|
|
|
return modal_template(content, "Example Translations", message.EditExampleTranslation, example)
|
|
|
|
|
|
|
|
|
|
|