Added kontrastivno special tag

pull/1/head
Ozbolt Menegatti 4 years ago
parent 00b10796e9
commit 350f9e58ab

@ -16,6 +16,9 @@ def label_list_getter():
lvalue = row.querySelector(".label-value")
lother = row.querySelector(".label-value-other")
if lother is None:
continue
value = lother.value
if not value:
value = lvalue.options[lvalue.selectedIndex].text
@ -24,5 +27,9 @@ def label_list_getter():
continue
result.append((ltype.textContent, value))
kontrastivno = document.getElementById("kontrastivno-input").checked;
if kontrastivno:
result.append(("relation", "kontrastivno"))
return result

@ -59,8 +59,16 @@ def label_list_editor(current_labels, add_label_message_class):
[])
return split_line3(left, center, right)
content = [dropdown_right(key, value) for key, value in current_labels]
content = []
kontrastivno = False
for key, value in current_labels:
# we will show kontrastivno a bit differently
if value == "kontrastivno":
kontrastivno = True
continue
content.append(dropdown_right(key, value))
# add a way to get new element to add to tag list
def get_new_label_type():
@ -68,11 +76,18 @@ def label_list_editor(current_labels, add_label_message_class):
return (select.options[select.selectedIndex].text, "")
add_label_message_class.append(get_new_label_type)
content.append(split_line3(
h("", {}, []),
h("label", {}, [
h("input#kontrastivno-input", {"props": {"type": "checkbox", "checked": kontrastivno}}, []),
h("span.checkable", {}, "kontrastivno")]),
h("", {}, [])))
left = h("span", {}, "Add more!")
center = h("select#new-tag-select", {}, [h("option", {}, ltype) for ltype in TAGS.keys()])
right = h("button", {"style": {"float": "right"}, "on": {"click": message.msg(*add_label_message_class)}}, "+")
content.append(split_line3(left, center, right, False))
content.append(h("hr", {}, []))
return content

Loading…
Cancel
Save