edited/modified example atribute supported
This commit is contained in:
parent
42aef17473
commit
b24af95d5d
|
@ -49,6 +49,7 @@ class EditExampleText(Message):
|
|||
def update_model(self, model):
|
||||
example = self.get_arg(0, Example)
|
||||
example.overwrite_with_copy()
|
||||
example.edited = True
|
||||
|
||||
idx = 0
|
||||
for txt in document.getElementsByClassName("example-component-text"):
|
||||
|
|
|
@ -15,17 +15,21 @@ class Example(Data):
|
|||
self.translations = []
|
||||
self.inner = None
|
||||
self.components = []
|
||||
self.edited = False
|
||||
|
||||
def import_xml(self, example_xml):
|
||||
self.translations = from_container_list(example_xml.querySelectorAll("translationContainer"))
|
||||
|
||||
if example_xml.hasAttribute("modified"):
|
||||
self.edited = example_xml.getAttribute("modified") == "true"
|
||||
|
||||
inner_xml = example_xml.querySelector("corpusExample")
|
||||
if inner_xml is not None:
|
||||
self.inner = CorpusExample()
|
||||
else:
|
||||
inner_xml = example_xml.querySelector("multiwordExample")
|
||||
self.inner = MultiwordExample()
|
||||
|
||||
|
||||
self.inner.import_xml(inner_xml)
|
||||
|
||||
for comp_xml in inner_xml.childNodes:
|
||||
|
@ -37,6 +41,9 @@ class Example(Data):
|
|||
def export(self, doc):
|
||||
result = doc.createElement("exampleContainer")
|
||||
|
||||
if self.edited:
|
||||
result.setAttribute("modified", "true")
|
||||
|
||||
inner = self.inner.export(doc)
|
||||
# TODO: bad quick fix
|
||||
for comp in self.components:
|
||||
|
|
Loading…
Reference in New Issue
Block a user