Add enrichment function for post bodies
This commit is contained in:
@@ -55,6 +55,7 @@ body {
|
||||
#catalog {
|
||||
display: flex;
|
||||
margin: 2rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.catalog-preview {
|
||||
@@ -62,8 +63,7 @@ body {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
border: 2px solid rgba(111, 111, 111, 0.34);
|
||||
min-width: 140px;
|
||||
max-width: 200px;
|
||||
width: 200px;
|
||||
max-height: 192px;
|
||||
}
|
||||
|
||||
@@ -187,6 +187,10 @@ body {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.greentext {
|
||||
color: #789922
|
||||
}
|
||||
|
||||
/* GENERAL LAYOUT */
|
||||
|
||||
.container {
|
||||
|
||||
@@ -3,6 +3,7 @@ package views
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dominicf2001/comfychan/internal/database"
|
||||
"github.com/dominicf2001/comfychan/internal/util"
|
||||
"github.com/dominicf2001/comfychan/web/views/shared"
|
||||
"strconv"
|
||||
)
|
||||
@@ -21,7 +22,9 @@ templ ThreadPosts(posts []database.Post) {
|
||||
<span class="post-time">{ post.CreatedAt.Format("15:04") }</span>
|
||||
<span class="post-num">No. { strconv.Itoa(post.Id) }</span>
|
||||
</header>
|
||||
<p>{ post.Body }</p>
|
||||
<p>
|
||||
@templ.Raw(util.EnrichPost(post.Body))
|
||||
</p>
|
||||
</article>
|
||||
<br/>
|
||||
}
|
||||
@@ -71,7 +74,9 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
|
||||
<span class="post-time">{ posts[0].CreatedAt.Format("15:04") }</span>
|
||||
<span class="post-num">No. { strconv.Itoa(posts[0].Id) }</span>
|
||||
</header>
|
||||
<p class="post-body">{ posts[0].Body }</p>
|
||||
<p class="post-body">
|
||||
@templ.Raw(util.EnrichPost(posts[0].Body))
|
||||
</p>
|
||||
</article>
|
||||
<div hx-get={ fmt.Sprintf("/hx/%s/threads/%d/posts", board.Slug, thread.Id) } hx-trigger="refreshPosts from:body">
|
||||
@ThreadPosts(posts[1:])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package views
|
||||
|
||||
import "fmt"
|
||||
import "github.com/dominicf2001/comfychan/internal/util"
|
||||
|
||||
type CatalogThreadPreview struct {
|
||||
Subject string
|
||||
@@ -17,7 +18,9 @@ templ ThreadsCatalog(previews []CatalogThreadPreview) {
|
||||
<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>
|
||||
<p>
|
||||
@templ.Raw(util.EnrichPost(preview.Body))
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user