|
|
import message
|
|
|
from lib.snabbdom import h
|
|
|
|
|
|
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)}}, "OK"),
|
|
|
h("label.button.dangerous", {"on": {"click": reset}}, "Cancel")])]
|
|
|
|
|
|
|
|
|
def question(question, current_value):
|
|
|
return [
|
|
|
h("span", {}, question),
|
|
|
h("label", {}, [
|
|
|
h("input#modal-question", {"props": {"type": "text", "value": current_value}}, "")])]
|
|
|
|
|
|
|
|
|
def generic_list_editor(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
|