incremental progess
This commit is contained in:
@@ -11,7 +11,7 @@ use maud::{html, Markup};
|
||||
/// - `cx.run()` for data fetching
|
||||
/// - `cx.signal()` with `global()` scoping + `Signal::val` in expressions
|
||||
/// - `cx.signal()` with `mangle().client_only()` scoping (in todo_item)
|
||||
/// - DataStar `data-bind`, `data-on-click`, `data-attr` attributes
|
||||
/// - DataStar `data-bind`, `data-on:click`, `data-attr` attributes
|
||||
/// - `@post()` actions for mutations
|
||||
pub async fn todo_list(cx: &mut RenderContext) -> anyhow::Result<Markup> {
|
||||
// Fetch all todos
|
||||
@@ -34,7 +34,7 @@ pub async fn todo_list(cx: &mut RenderContext) -> anyhow::Result<Markup> {
|
||||
span.nav-current { "Todos" }
|
||||
" | "
|
||||
button.nav-link
|
||||
data-on-click="$tree = {page: 'About'}; @post('/render')" {
|
||||
data-on:click="$tree = {page: 'About'};" {
|
||||
"About"
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ pub async fn todo_list(cx: &mut RenderContext) -> anyhow::Result<Markup> {
|
||||
data-bind="newTodo"
|
||||
;
|
||||
button
|
||||
data-on-click="@post('/action/add_todo')"
|
||||
data-on:click="@post('/action/add_todo')"
|
||||
data-attr=(format!("{{disabled: {}.trim() === ''}}", new_todo.val)) {
|
||||
"Add"
|
||||
}
|
||||
@@ -104,7 +104,7 @@ fn todo_item(cx: &mut RenderContext, todo: &Todo) -> Markup {
|
||||
input
|
||||
type="checkbox"
|
||||
checked[todo.completed]
|
||||
data-on-click=(format!("@post('/action/toggle_todo?id={}')", todo.id))
|
||||
data-on:click=(format!("@post('/action/toggle_todo?id={}')", todo.id))
|
||||
;
|
||||
|
||||
// Title with strikethrough when completed (class set server-side)
|
||||
@@ -114,7 +114,7 @@ fn todo_item(cx: &mut RenderContext, todo: &Todo) -> Markup {
|
||||
|
||||
// Delete button
|
||||
button.delete-btn
|
||||
data-on-click=(format!("@post('/action/delete_todo?id={}')", todo.id))
|
||||
data-on:click=(format!("@post('/action/delete_todo?id={}')", todo.id))
|
||||
{
|
||||
"×"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user