Example translation editing

This commit is contained in:
2019-11-16 14:18:37 +01:00
parent 4a80ba878a
commit e287e2414a
8 changed files with 62 additions and 9 deletions

View File

@@ -32,6 +32,30 @@ class AddSenseLabel(NoReset):
def update_model(self, model):
# just adding to the copy to show in the modal
self.sense.copy().labels.append("")
class AddExampleTranslation(NoReset):
def __init__(self, _, prop):
assert(type(prop) is Example)
self.example = prop
def update_model(self, model):
# just adding to the copy to show in the modal
self.example.copy().translations.append("")
class EditExampleTranslation(Message):
def __init__(self, _, prop):
assert(type(prop) is Example)
self.example = prop
def update_model(self, model):
self.example.translations = []
for input_el in document.getElementsByClassName("example-translation-edit-input"):
new_example_translation = input_el.value
if new_example_translation != "":
self.example.translations.append(new_example_translation)
class AddSense(SimpleEditMessage):