mt-additional-xml-shema-support #6
|
@ -10,13 +10,16 @@ def generic_list_getter():
|
|||
return result
|
||||
|
||||
# Formats data from inputs to name-value objects
|
||||
def double_list_getter(firstParameter, secondParameter):
|
||||
def double_list_getter(firstParameter, secondParameter, allowEmptyField = False):
|
||||
result = []
|
||||
for row in document.getElementsByClassName("double-list-row"):
|
||||
firstValue = row.querySelector("." + firstParameter + "-input").value
|
||||
secondValue = row.querySelector("." + secondParameter + "-input").value
|
||||
|
||||
if ("" in [firstValue, secondValue]):
|
||||
if (allowEmptyField is False and '' in [firstValue, secondValue]):
|
||||
continue
|
||||
|
||||
if (allowEmptyField is True and all('' == value or value.isspace() for value in [firstValue, secondValue])):
|
||||
continue
|
||||
|
||||
result.append({firstParameter: firstValue, secondParameter: secondValue})
|
||||
|
|
|
@ -13,8 +13,8 @@ class EditTranslation(DataChgClickMessage):
|
|||
self.old_cluster_idx = self.get_arg(1, int)
|
||||
|
||||
self.translation.translation = document.getElementById("etv").value
|
||||
# This could be dangerous if generic_list_getter is getting data from any other list as well.
|
||||
self.translation.explanationList = common_accessors.generic_list_getter()
|
||||
# This could be dangerous if double_list_getter is getting data from any other list as well.
|
||||
self.translation.explanationList = common_accessors.double_list_getter('value', 'language', True)
|
||||
|
||||
# common_accessors.label_list_getter()
|
||||
self.translation.tags = common_accessors.label_list_getter()
|
||||
|
|
Loading…
Reference in New Issue
Block a user