Only show blog content preview in blog index when there are few posts
Partially resolves issue #30
This commit is contained in:
parent
2012328436
commit
86a7128f25
|
@ -20,15 +20,17 @@
|
|||
<div class="details">
|
||||
<a class="user" href="{{ .Author.ProfileUrl }}">{{ .Author.Name }}</a> — {{ timehtml (relativedate .Date) .Date }}
|
||||
</div>
|
||||
<div class="overflow-hidden mh-5 mt2 relative">
|
||||
<div>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="excerpt-fade absolute w-100 h4 bottom-0 z-999"></div>
|
||||
</div>
|
||||
<div class="mt2">
|
||||
<a href="{{ .Url }}">Read More →</a>
|
||||
</div>
|
||||
{{ if $.ShowContent }}
|
||||
<div class="overflow-hidden mh-5 mt2 relative">
|
||||
<div>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="excerpt-fade absolute w-100 h4 bottom-0 z-999"></div>
|
||||
</div>
|
||||
<div class="mt2">
|
||||
<a href="{{ .Url }}">Read More →</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -30,11 +30,12 @@ func BlogIndex(c *RequestContext) ResponseData {
|
|||
Posts []blogIndexEntry
|
||||
Pagination templates.Pagination
|
||||
|
||||
ShowContent bool
|
||||
CanCreatePost bool
|
||||
NewPostUrl string
|
||||
}
|
||||
|
||||
const postsPerPage = 5
|
||||
const postsPerPage = 20
|
||||
|
||||
numThreads, err := hmndata.CountThreads(c.Context(), c.Conn, c.CurrentUser, hmndata.ThreadsQuery{
|
||||
ProjectIDs: []int{c.CurrentProject.ID},
|
||||
|
@ -105,6 +106,7 @@ func BlogIndex(c *RequestContext) ResponseData {
|
|||
NextUrl: c.UrlContext.BuildBlog(utils.IntClamp(1, page+1, numPages)),
|
||||
},
|
||||
|
||||
ShowContent: len(entries) <= 5,
|
||||
CanCreatePost: canCreate,
|
||||
NewPostUrl: c.UrlContext.BuildBlogNewThread(),
|
||||
}, c.Perf)
|
||||
|
|
Loading…
Reference in New Issue