1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-17 10:56:24 -07:00

Add filename to recentPost struct

This commit is contained in:
Eggbertx 2022-12-21 15:34:22 -08:00
parent cad707baf6
commit 0362645e2c
2 changed files with 3 additions and 1 deletions

View file

@ -24,6 +24,7 @@ type recentPost struct {
Board string
URL string
ThumbURL string
Filename string
FileDeleted bool
MessageSample string
}
@ -81,6 +82,7 @@ func getRecentPosts() ([]recentPost, error) {
Board: boardDir,
URL: config.WebPath(boardDir, "res", topPostID+".html") + "#" + id,
ThumbURL: config.WebPath(boardDir, "thumb", gcutil.GetThumbnailPath("post", filename)),
Filename: filename,
FileDeleted: filename == "deleted",
MessageSample: message,
}

View file

@ -33,7 +33,7 @@
<div id="recent-posts">
{{- range $i, $post := $.recent_posts}}
<div class="recent-post">
{{if and (not $post.FileDeleted) (ne $post.ThumbURL "") -}}
{{if and (not $post.FileDeleted) (ne $post.Filename "") -}}
<a href="{{$post.URL}}" class="front-reply" target="_blank"><img src="{{$post.ThumbURL}}" alt="post thumbnail"/></a><br />
{{else}}
<div class="file-deleted-box" style="text-align:center; float:none;"><a href="{{$post.URL}}" class="front-reply" target="_blank">No file</a></div>