Tweak news appearance

This commit is contained in:
Ben Visness 2021-10-25 09:07:14 -05:00
parent f8d5f9fce5
commit 3324428f8b
3 changed files with 14 additions and 8 deletions

View File

@ -1,16 +1,18 @@
<div class="timeline-item flex flex-column pa3 mb2 br3" {{ with .FilterTitle }}data-filter-title="{{ . }}"{{ end }}>
{{/* top bar - avatar, info, date */}}
<div class="flex items-center">
<a class="flex-shrink-0" href="{{ .OwnerUrl }}">
<img class="avatar-icon lite {{ if not .SmallInfo }}big{{ end }} {{ if .SmallInfo }}mr2{{ else }}mr3{{ end }}" src="{{ .OwnerAvatarUrl }}" />
</a>
{{ if .OwnerAvatarUrl }}
<a class="flex-shrink-0" href="{{ .OwnerUrl }}">
<img class="avatar-icon lite {{ if not .SmallInfo }}big{{ end }} {{ if .SmallInfo }}mr2{{ else }}mr3{{ end }}" src="{{ .OwnerAvatarUrl }}" />
</a>
{{ end }}
<div class="overflow-hidden flex-grow-1 flex flex-column justify-center">
{{ if .Breadcrumbs }}
{{ template "breadcrumbs.html" .Breadcrumbs }}
{{ end }}
{{ if .Title }}
<div class="f5 nowrap truncate">
<div class="f5 {{ if not .AllowTitleWrap }}nowrap truncate{{ end }}">
{{ with .TypeTitle }}<b class="dn di-ns">{{ . }}:</b>{{ end }}
<a href="{{ .Url }}">{{ .Title }}</a>
</div>

View File

@ -257,14 +257,15 @@ type TimelineItem struct {
OwnerName string
OwnerUrl string
Description template.HTML
TruncateDescription bool
Description template.HTML
PreviewMedia TimelineItemMedia
EmbedMedia []TimelineItemMedia
SmallInfo bool
CanShowcase bool // whether this snippet can be shown in a showcase gallery
SmallInfo bool
AllowTitleWrap bool
TruncateDescription bool
CanShowcase bool // whether this snippet can be shown in a showcase gallery
}
type TimelineItemMediaType int

View File

@ -98,7 +98,10 @@ func Index(c *RequestContext) ResponseData {
if len(newsThreads) > 0 {
t := newsThreads[0]
item := PostToTimelineItem(lineageBuilder, &t.FirstPost, &t.Thread, &t.Project, t.FirstPostAuthor, c.Theme)
item.OwnerAvatarUrl = ""
item.Breadcrumbs = nil
item.TypeTitle = ""
item.AllowTitleWrap = true
item.Description = template.HTML(t.FirstPostCurrentVersion.TextParsed)
item.TruncateDescription = true
newsPostItem = &item