From 4e744db68f252c15eeed1797a28bd297ca7ac85c Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Thu, 19 Mar 2020 21:29:19 +0100 Subject: [PATCH] opombe and prevedek now textarea and not just text input --- src/view/modal_templates.py | 15 ++++++++++++--- src/view/modals.py | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/view/modal_templates.py b/src/view/modal_templates.py index 59da9dd..104320e 100644 --- a/src/view/modal_templates.py +++ b/src/view/modal_templates.py @@ -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)] diff --git a/src/view/modals.py b/src/view/modals.py index 4c197ed..c5271ff 100644 --- a/src/view/modals.py +++ b/src/view/modals.py @@ -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):