diff --git a/collections.go b/collections.go index 66ad7a0..5c9a1b7 100644 --- a/collections.go +++ b/collections.go @@ -63,6 +63,7 @@ type ( TotalPosts int `json:"total_posts"` Owner *User `json:"owner,omitempty"` Posts *[]PublicPost `json:"posts,omitempty"` + Format *CollectionFormat } DisplayCollection struct { *CollectionObj @@ -70,7 +71,6 @@ type ( IsTopLevel bool CurrentPage int TotalPages int - Format *CollectionFormat Suspended bool } SubmittedCollection struct { @@ -556,6 +556,13 @@ type CollectionPage struct { CanInvite bool } +func NewCollectionObj(c *Collection) *CollectionObj { + return &CollectionObj{ + Collection: *c, + Format: c.NewFormat(), + } +} + func (c *CollectionObj) ScriptDisplay() template.JS { return template.JS(c.Script) } @@ -705,11 +712,10 @@ func checkUserForCollection(app *App, cr *collectionReq, r *http.Request, isPost func newDisplayCollection(c *Collection, cr *collectionReq, page int) *DisplayCollection { coll := &DisplayCollection{ - CollectionObj: &CollectionObj{Collection: *c}, + CollectionObj: NewCollectionObj(c), CurrentPage: page, Prefix: cr.prefix, IsTopLevel: isSingleUser, - Format: c.NewFormat(), } c.db.GetPostsCount(coll.CollectionObj, cr.isCollOwner) return coll diff --git a/less/post-temp.less b/less/post-temp.less index 3ec682d..8173864 100644 --- a/less/post-temp.less +++ b/less/post-temp.less @@ -17,6 +17,16 @@ body { font-size: 1.6em; } } + article { + h2#title.dated { + margin-bottom: 0.5em; + } + time.dt-published { + display: block; + color: #666; + margin-bottom: 1em; + } + } } } diff --git a/posts.go b/posts.go index 21ed1a1..d2fbcca 100644 --- a/posts.go +++ b/posts.go @@ -1354,7 +1354,7 @@ func viewCollectionPost(app *App, w http.ResponseWriter, r *http.Request) error // Fetch extra data about the Collection // TODO: refactor out this logic, shared in collection.go:fetchCollection() - coll := &CollectionObj{Collection: *c} + coll := NewCollectionObj(c) owner, err := app.db.GetUserByID(coll.OwnerID) if err != nil { // Log the error and just continue diff --git a/templates/chorus-collection-post.tmpl b/templates/chorus-collection-post.tmpl index b9df8ad..0e1164b 100644 --- a/templates/chorus-collection-post.tmpl +++ b/templates/chorus-collection-post.tmpl @@ -37,16 +37,6 @@ body footer { } body#post header { padding: 1em 1rem; -} -article time.dt-published { - display: block; - color: #666; -} -body#post article h2#title{ - margin-bottom: 0.5em; -} -article time.dt-published { - margin-bottom: 1em; } @@ -68,7 +58,7 @@ article time.dt-published { {{if .Suspended}} {{template "user-suspended"}} {{end}} -
{{if .IsScheduled}}

Scheduled

{{end}}{{if .Title.String}}

{{.FormattedDisplayTitle}}

{{end}}{{/* TODO: check format: if .Collection.Format.ShowDates*/}}
{{.HTMLContent}}
+
{{if .IsScheduled}}

Scheduled

{{end}}{{if .Title.String}}

{{.FormattedDisplayTitle}}

{{end}}{{if $.Collection.Format.ShowDates}}{{end}}
{{.HTMLContent}}
{{ if .Collection.ShowFooterBranding }}