Refactored Command to add owner
This commit is contained in:
@@ -49,8 +49,14 @@ def get():
|
||||
mk.manage_binding(datalist, Binding(data))
|
||||
mk.manage_binding(label_elt, Binding(data))
|
||||
|
||||
add_button = mk.button("Add", command=Command("Add", "Add a suggestion", add_suggestion).bind(data))
|
||||
remove_button = mk.button("Remove", command=Command("Remove", "Remove a suggestion", remove_suggestion).bind(data))
|
||||
add_button = mk.button("Add", command=Command("Add",
|
||||
"Add a suggestion",
|
||||
None,
|
||||
add_suggestion).bind(data))
|
||||
remove_button = mk.button("Remove", command=Command("Remove",
|
||||
"Remove a suggestion",
|
||||
None,
|
||||
remove_suggestion).bind(data))
|
||||
|
||||
return Div(
|
||||
add_button,
|
||||
|
||||
@@ -11,7 +11,10 @@ def say_hello():
|
||||
|
||||
|
||||
# Create the command
|
||||
hello_command = Command("say_hello", "Responds with a greeting", say_hello)
|
||||
hello_command = Command("say_hello",
|
||||
"Responds with a greeting",
|
||||
None,
|
||||
say_hello)
|
||||
|
||||
# Create the app
|
||||
app, rt = create_app(protect_routes=False)
|
||||
|
||||
@@ -13,7 +13,10 @@ def change_text():
|
||||
return "New text"
|
||||
|
||||
|
||||
command = Command("change_text", "change the text", change_text).htmx(target="#text")
|
||||
command = Command("change_text",
|
||||
"change the text",
|
||||
None,
|
||||
change_text).htmx(target="#text")
|
||||
|
||||
|
||||
@rt("/")
|
||||
|
||||
Reference in New Issue
Block a user