Small tweaks

This commit is contained in:
Dominic Ferrando
2025-04-18 16:19:03 -04:00
parent a80a7a4dba
commit edd16bcd94
2 changed files with 9 additions and 7 deletions
+4 -2
View File
@@ -16,6 +16,8 @@ templ NewThreadForm(board database.Board) {
_="on htmx:afterRequest _="on htmx:afterRequest
hide me hide me
then show #newThreadBtn then show #newThreadBtn
then set #newPostBody.value to ''
then set #newPostFile.value to ''
then trigger refreshThreads on body" then trigger refreshThreads on body"
> >
<table> <table>
@@ -26,11 +28,11 @@ templ NewThreadForm(board database.Board) {
</tr> </tr>
<tr class="new-post-form-field"> <tr class="new-post-form-field">
<th>Comment</th> <th>Comment</th>
<td><textarea name="body" required></textarea></td> <td><textarea id="newPostBody" name="body" required></textarea></td>
</tr> </tr>
<tr class="new-post-form-field"> <tr class="new-post-form-field">
<th>File</th> <th>File</th>
<td><input name="file" type="file" required/></td> <td><input id="newPostFile" name="file" type="file" required/></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+5 -5
View File
@@ -39,6 +39,7 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
board.Slug, thread.Id) } board.Slug, thread.Id) }
_="on htmx:afterRequest _="on htmx:afterRequest
set #newPostBody.value to '' set #newPostBody.value to ''
then set #newPostFile.value to ''
then trigger refreshPosts on body" then trigger refreshPosts on body"
> >
<table> <table>
@@ -49,7 +50,7 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
</tr> </tr>
<tr class="new-post-form-field"> <tr class="new-post-form-field">
<th>File</th> <th>File</th>
<td><input name="file" type="file"/></td> <td><input id="newPostFile" name="file" type="file"/></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -72,10 +73,9 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
</header> </header>
<p class="post-body">{ posts[0].Body }</p> <p class="post-body">{ posts[0].Body }</p>
</article> </article>
<div <div hx-get={ fmt.Sprintf("/hx/%s/threads/%d/posts", board.Slug, thread.Id) } hx-trigger="refreshPosts from:body">
hx-get={ fmt.Sprintf("/hx/%s/threads/%d/posts", board.Slug, thread.Id) } @ThreadPosts(posts[1:])
hx-trigger="load, refreshPosts from:body" </div>
></div>
</div> </div>
} }
} }