Refactored Command to add owner

This commit is contained in:
2025-12-08 21:07:34 +01:00
parent 3aa36a91aa
commit 045f01b48a
19 changed files with 138 additions and 101 deletions

View File

@@ -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,

View File

@@ -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)

View File

@@ -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("/")