Show approved newswire items in a different style

main
Bob Mottram 2020-10-06 20:13:02 +01:00
parent 6481e9f528
commit 143354d537
3 changed files with 43 additions and 7 deletions

View File

@ -15,6 +15,7 @@
--main-fg-color: #dddddd;
--column-left-fg-color: #dddddd;
--column-right-fg-color: #dddddd;
--column-right-fg-color-approved: yellow;
--main-link-color: #999;
--main-link-color-hover: #bbb;
--main-visited-color: #888;
@ -231,12 +232,26 @@ a:focus {
line-height: var(--line-spacing-newswire);
}
.newswireItemApproved {
font-size: var(--font-size-newswire);
font-weight: bold;
color: var(--column-right-fg-color-approved);
line-height: var(--line-spacing-newswire);
}
.newswireDate {
font-size: var(--font-size-newswire);
color: var(--newswire-date-color);
float: right;
}
.newswireDateApproved {
font-size: var(--font-size-newswire);
font-weight: bold;
color: var(--newswire-date-color);
float: right;
}
.new-post-text {
font-size: var(--font-size2);
font-family: Arial, Helvetica, sans-serif;

View File

@ -232,7 +232,8 @@ def addAccountBlogsToNewswire(baseDir: str, nickname: str, domain: str,
published = published.replace('Z', '+00:00')
newswire[published] = \
[postJsonObject['object']['summary'],
postJsonObject['object']['url']]
postJsonObject['object']['url'],
['votes:0']]
ctr += 1
if ctr >= maxBlogsPerAccount:

View File

@ -5339,13 +5339,33 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
return htmlStr
def htmlNewswire(newswire: str) -> str:
def htmlNewswire(newswire: str, nickname: str, moderator: bool) -> str:
"""Converts a newswire dict into html
"""
htmlStr = ''
for dateStr, item in newswire.items():
if 'vote:' + nickname in item[2]:
htmlStr += '<p class="newswireItemApproved">' + \
'<a href="' + item[1] + '">' + item[0] + '</a>'
if moderator:
htmlStr += \
' <label class="newswireDateApproved">' + \
'<a href="/users/' + nickname + \
'/newswireunvote=' + dateStr + '">'
htmlStr += dateStr.replace('+00:00', '') + '</a></label></p>'
else:
htmlStr += ' <label class="newswireDateApproved">'
htmlStr += dateStr.replace('+00:00', '') + '</label></p>'
else:
htmlStr += '<p class="newswireItem">' + \
'<a href="' + item[1] + '">' + item[0] + '</a>'
if moderator:
htmlStr += \
' <label class="newswireDate">' + \
'<a href="/users/' + nickname + \
'/newswirevote=' + dateStr + '">'
htmlStr += dateStr.replace('+00:00', '') + '</a></label></p>'
else:
htmlStr += ' <label class="newswireDate">'
htmlStr += dateStr.replace('+00:00', '') + '</label></p>'
return htmlStr
@ -5426,7 +5446,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
else:
htmlStr += ' <br>\n'
htmlStr += htmlNewswire(newswire)
htmlStr += htmlNewswire(newswire, nickname, moderator)
return htmlStr