Basic file upload for thread creation
This commit is contained in:
@@ -7,7 +7,8 @@ database "github.com/dominicf2001/comfychan/internal/database"
|
||||
)
|
||||
|
||||
templ NewThreadForm(board database.Board) {
|
||||
<form style="display: none;" id="newThreadForm" hx-swap="none" hx-post={ fmt.Sprintf("/%s/threads", board.Slug) } _="on htmx:afterRequest
|
||||
<form hx-encoding="multipart/form-data" style="display: none;" id="newThreadForm" hx-swap="none" hx-post={
|
||||
fmt.Sprintf("/%s/threads", board.Slug) } _="on htmx:afterRequest
|
||||
hide me
|
||||
then show #newThreadBtn
|
||||
then trigger refreshThreads on body">
|
||||
@@ -21,6 +22,10 @@ templ NewThreadForm(board database.Board) {
|
||||
<th>Comment</th>
|
||||
<td><textarea name="body" required></textarea></td>
|
||||
</tr>
|
||||
<tr class="new-post-form-field">
|
||||
<th>File</th>
|
||||
<td><input name="file" type="file" required /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit">Submit</button>
|
||||
|
||||
@@ -13,7 +13,9 @@ templ ThreadsCatalog(previews []CatalogThreadPreview) {
|
||||
<div id="catalog">
|
||||
for _, preview := range previews {
|
||||
<div class="catalog-preview">
|
||||
<img class="catalog-preview-img" src={ fmt.Sprintf("/static/img/posts/%s", preview.MediaPath) } />
|
||||
<a href={ templ.SafeURL(preview.ThreadURL) }>
|
||||
<img class="catalog-preview-img" src={ fmt.Sprintf("/static/img/posts/%s", preview.MediaPath) } />
|
||||
</a>
|
||||
<h1><a href={ templ.SafeURL(preview.ThreadURL) } class="catalog-preview-link">{ preview.Subject }</a></h1>
|
||||
<p>{ preview.Body }</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user