Show just one avatar in detail view. Make date a permalink, when available.

This commit is contained in:
Brent Simmons 2017-12-29 18:59:04 -08:00
parent 3b92c543fb
commit 65fcbf00bf
1 changed files with 26 additions and 20 deletions

View File

@ -167,20 +167,21 @@ class ArticleRenderer {
d["newsitem_description"] = body d["newsitem_description"] = body
d["avatars"] = "" d["avatars"] = ""
if let avatars = avatarsToShow() { if let avatar = avatarToUse() {
var avatarHTML = "" let avatarHTML = avatar.html(dimension: 64)
var ix = 0
let ct = avatars.count
for avatar in avatars {
avatarHTML += avatar.html(dimension: 64)
if ix < ct - 1 {
avatarHTML += "&nbsp;"
}
ix += 1
}
if !avatarHTML.isEmpty {
d["avatars"] = avatarHTML d["avatars"] = avatarHTML
} // var ix = 0
// let ct = avatars.count
// for avatar in avatars {
// avatarHTML += avatar.html(dimension: 64)
// if ix < ct - 1 {
// avatarHTML += "&nbsp;"
// }
// ix += 1
// }
// if !avatarHTML.isEmpty {
// d["avatars"] = avatarHTML
// }
} }
var feedLink = "" var feedLink = ""
@ -194,13 +195,18 @@ class ArticleRenderer {
d["feedlink_withfavicon"] = feedLink d["feedlink_withfavicon"] = feedLink
let longDate = longDateFormatter.string(from: article.logicalDatePublished) let longDate = longDateFormatter.string(from: article.logicalDatePublished)
d["date_long"] = longDate
let mediumDate = mediumDateFormatter.string(from: article.logicalDatePublished) let mediumDate = mediumDateFormatter.string(from: article.logicalDatePublished)
d["date_medium"] = mediumDate
let shortDate = shortDateFormatter.string(from: article.logicalDatePublished) let shortDate = shortDateFormatter.string(from: article.logicalDatePublished)
if let permalink = article.url {
d["date_long"] = linkWithText(longDate, permalink)
d["date_medium"] = linkWithText(mediumDate, permalink)
d["date_short"] = linkWithText(shortDate, permalink)
}
else {
d["date_long"] = longDate
d["date_medium"] = mediumDate
d["date_short"] = shortDate d["date_short"] = shortDate
}
d["byline"] = byline() d["byline"] = byline()
// d["author_avatar"] = authorAvatar() // d["author_avatar"] = authorAvatar()