WIP: changed how some modals get created, also adopting for new msg()

This commit is contained in:
2019-11-17 21:19:01 +01:00
parent 5302d49396
commit 14655bd6cf
2 changed files with 14 additions and 15 deletions

View File

@@ -1,24 +1,23 @@
import message
from lib.snabbdom import h
def modal_template(content, title, msg, prop):
reset = message.msg(message.ModalNotOkClose)
def modal_template(content, title, msg):
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("a.button", {"on": {"click": message.msg(msg)}}, "OK"),
h("label.button.dangerous", {"on": {"click": reset}}, "Cancel")])]
def one_question_modal(title, msg, question, current_value, prop):
content = [
def question(question, current_value):
return [
h("span", {}, question),
h("label", {}, [
h("input#modal-input", {"props": {"type": "text", "value": current_value}}, "")])]
return modal_template(content, title, msg, prop)
h("input#modal-question", {"props": {"type": "text", "value": current_value}}, "")])]
def generic_list_editor(title, element_list_getter, add_click_message):