Browse Source

upsy daisys

pull/2/head
matic_t 2 years ago
parent
commit
9c007f6dd6
  1. 7
      src/export.py
  2. 1
      src/message/common_accessors.py
  3. 2
      src/model/entry.py
  4. 5
      src/view/modal_templates.py

7
src/export.py

@ -32,10 +32,11 @@ def export_entry(entry):
homonymy = doc.createElement("homonymy")
headword.appendChild(homonymy)
for h in entry.homonymy:
for hFeature in entry.homonymy:
feature = doc.createElement("homonymyFeature")
feature.textContent = h.value
feature.setAttribute("name", h["name"])
feature.textContent = hFeature.value
# Can't use hFeature.name, because Python has name reserver and so it becomes py_name in JS
feature.setAttribute("name", hFeature["name"])
homonymy.appendChild(feature)

1
src/message/common_accessors.py

@ -9,6 +9,7 @@ def generic_list_getter():
result.append(result_candidate)
return result
# Formats data from inputs to name-value objects
def homonymy_list_getter():
result = []
for row in document.getElementsByClassName("label-list-row"):

2
src/model/entry.py

@ -96,7 +96,7 @@ class Entry(Data):
if len(self.homonymy) == 0:
view_buttons.append(buttons[4])
else:
view_table.append((buttons[4], ", ".join(h.value for h in self.homonymy)))
view_table.append((buttons[4], ", ".join((h["name"] + ": " + h.value) for h in self.homonymy)))
if len(self.related_entries) == 0:
view_buttons.append(buttons[1])

5
src/view/modal_templates.py

@ -55,12 +55,13 @@ def homonymy_editor(title, current_labels):
content = [h("p", {}, title)]
for i, feature in enumerate(current_labels()):
name = [h("div")]
value = [h("div")]
name = []
value = []
name.append(h("label", {"attrs": {"for": i}}, "Name:"))
name.append(h("input.name-input", {"props": {"type": "text", "value": feature["name"], "id": i}}, ""))
value.append(h("label", {"attrs": {"for": i + "-value"}}, "Value:"))
value.append(h("input.value-input", {"props": {"type": "text", "value": feature["value"], "id": i + "-value"}}, ""))
content.append(split_line2(name, value))
content.append(h("button", {"on": {"click": message.msg(message.AddToGenericList, current_labels)}}, "+"))

Loading…
Cancel
Save