Minor cleanup and bugfi
This commit is contained in:
+15
-13
@@ -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>
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
Reference in New Issue
Block a user