opombe and prevedek now textarea and not just text input

This commit is contained in:
Ozbolt Menegatti 2020-03-19 21:29:19 +01:00
parent 6438cf52d1
commit 4e744db68f
2 changed files with 14 additions and 5 deletions

View File

@ -23,12 +23,21 @@ def modal_template(content, title, msg, delete_msg=None):
h("footer", {}, footer)]
def question(question, current_value):
def _question(question, current_value, input_element):
props = {"value": current_value}
if input_element == "input":
props["type"] = "text"
return [
h("span", {}, question),
h("label", {}, [
h("input#modal-question", {"props": {"type": "text", "value": current_value}}, "")])]
h("{}#modal-question".format(input_element), {"props": props}, "")])]
def big_question(question, current_value):
return _question(question, current_value, "textarea")
def question(question, current_value):
return _question(question, current_value, "input")
def generic_list_editor(title, element_list_getter):
content = [h("p", {}, title)]

View File

@ -20,7 +20,7 @@ def edit_translation(translation, parent, cluster_idx, num_clusters, cls):
# first line: transalation itself
content.extend([
split_line2("Prevedek:",
h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
h("textarea#etv", {"props": {"value": translation.translation}}, "")),
split_line2("Razlaga:",
h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))])
@ -98,7 +98,7 @@ def edit_sense_definition(sense):
def edit_comment(comment):
return modal_template(question("Edit comment", comment), "Comment", (message.EditComment,), (message.DeleteComment,))
return modal_template(big_question("Edit comment", comment), "Comment", (message.EditComment,), (message.DeleteComment,))
def do_chosen_examples(example_list, entry):