Minor cleanup and bugfi

This commit is contained in:
Dominic Ferrando
2025-04-22 17:28:02 -04:00
parent 0a2fd9951e
commit 024280e96d
4 changed files with 59 additions and 35 deletions
+15 -13
View File
@@ -16,19 +16,21 @@ templ NewThreadForm(board database.Board) {
id="newThreadForm"
hx-swap="none"
hx-post={ fmt.Sprintf("/%s/threads", board.Slug) }
_="on htmx:afterRequest
if event.detail.xhr.status is not 429
hide me
then show #newThreadBtn
then set #newPostBody.value to ''
then set #newPostFile.value to ''
then set #newPostSubject.value to ''
then hide #newPostWarning
then trigger refreshThreads on body
else
show #newPostWarning
then put event.detail.xhr.responseText into #newPostWarning
end"
_="
on htmx:beforeSend toggle @disabled on <button/> until htmx:afterRequest
on htmx:afterRequest
if event.detail.xhr.status is not 429
hide me
then show #newThreadBtn
then set #newPostBody.value to ''
then set #newPostFile.value to ''
then set #newPostSubject.value to ''
then hide #newPostWarning
then trigger refreshThreads on body
else
show #newPostWarning
then put event.detail.xhr.responseText into #newPostWarning
end"
>
<table>
<tbody>
+3 -1
View File
@@ -123,7 +123,9 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
id="newPostForm"
hx-target="#newPostWarning"
hx-post={ fmt.Sprintf("/%s/threads/%d", board.Slug, thread.Id) }
_="on htmx:afterRequest
_="
on htmx:beforeSend toggle @disabled on <button/> until htmx:afterRequest
on htmx:afterRequest
if event.detail.xhr.status is not 429
set #newPostBody.value to ''
then set #newPostFile.value to ''