Use hyperscript for rendering notifications

This commit is contained in:
Peter Stockings
2023-07-26 14:23:57 +10:00
parent bc7c15144a
commit 95b89ef9e8
3 changed files with 11 additions and 39 deletions

View File

@@ -61,10 +61,9 @@
<form class="w-full mt-3" hx-post="{{ url_for('create_person') }}" hx-swap="beforeend" hx-target="#new-person"
_="on htmx:afterRequest
js
displayNotification('User added')
end
then reset() me">
render #notification-template with (message: 'User added') then append it to #notifications-container
then call _hyperscript.processNode(#notifications-container)
then reset() me">
<div class="flex flex-wrap -mx-3 mb-2">
<div class="grow px-3">
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-city">
@@ -151,9 +150,8 @@
<form class="w-full mt-8" hx-post="{{ url_for('create_exercise') }}" hx-swap="beforeend"
hx-target="#new-exercise" _="on htmx:afterRequest
js
displayNotification('Exercise added')
end
render #notification-template with (message: 'Exercise added') then append it to #notifications-container
then call _hyperscript.processNode(#notifications-container)
then reset() me">
<div class="flex flex-wrap -mx-3 mb-2">
<div class="grow px-3">