-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shahrul
committed
Jan 29, 2024
1 parent
e0f1ba6
commit fbf823c
Showing
2 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
behavior AddTodo | ||
on load send focus to me | ||
on focus | ||
if $focus === undefined | ||
my.focus() | ||
set $isFocus to 'true' | ||
on focus | ||
if $focus === undefined | ||
my.focus() | ||
set $isFocus to 'true' | ||
end | ||
on blur set $isFocus to undefined | ||
on keyup[keyCode==13] | ||
if $todo | ||
htmx.ajax('GET', `/add-todo?title=${my.value}`, {target:'.todo-list', swap:'beforeend'}) | ||
set my value to '' | ||
else | ||
htmx.ajax('GET', `/add-todo?title=${my.value}`, {target:'.header', swap:'beforeend'}) | ||
set my value to '' | ||
end | ||
on blur set $isFocus to undefined | ||
on keyup[keyCode==13] | ||
if $todo | ||
htmx.ajax('GET', `/add-todo?title=${my.value}`, {target:'.todo-list', swap:'beforeend'}) | ||
set my value to '' | ||
else | ||
htmx.ajax('GET', `/add-todo?title=${my.value}`, {target:'.header', swap:'beforeend'}) | ||
set my value to '' | ||
end | ||
send toggleMain to <section.todoapp/> | ||
send toggleFooter to <section.todoapp/> | ||
end | ||
send toggleMain to <section.todoapp/> | ||
send toggleFooter to <section.todoapp/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters