You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lexonomy_custom_editor/src/view/modal_templates.py

31 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import message
from lib.snabbdom import h
def modal_template(content, title, msg, prop):
reset = message.msg(message.ModalNotOkClose)
return [
h("header", {}, [
h("h3", {}, title),
h("label.close", {"on": {"click": reset}}, "×")]),
h("section.content", {}, content ),
h("footer", {}, [
h("a.button", {"on": {"click": message.msg(msg, prop)}}, "OK"),
h("label.button.dangerous", {"on": {"click": reset}}, "Cancel")])]
def one_question_modal(title, msg, question, current_value, prop):
content = [
h("span", {}, question),
h("label", {}, [
h("input#modal-input", {"props": {"type": "text", "value": current_value}}, "")])]
return modal_template(content, title, msg, prop)
def list_adder(title, element_list_getter, add_click_message):
content = [h("span", {}, title)]
for slabel in element_list_getter():
content.append(h("label", {}, [
h("input.list-adder-input", {"props": {"type": "text", "value": slabel}}, "")]))
content.append(h("button", {"on": {"click": add_click_message}}, "+"))
return content