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

View File

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

View File

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