From 143354d5376f7d7a4a8b2d30d7c299685e3f7fc6 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 6 Oct 2020 20:13:02 +0100
Subject: [PATCH] Show approved newswire items in a different style
---
epicyon-profile.css | 15 +++++++++++++++
newswire.py | 3 ++-
webinterface.py | 32 ++++++++++++++++++++++++++------
3 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/epicyon-profile.css b/epicyon-profile.css
index ebf9d99a4..8a59c6386 100644
--- a/epicyon-profile.css
+++ b/epicyon-profile.css
@@ -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;
diff --git a/newswire.py b/newswire.py
index ff2274738..d47222c0d 100644
--- a/newswire.py
+++ b/newswire.py
@@ -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:
diff --git a/webinterface.py b/webinterface.py
index 6cbaa2e29..50ed03082 100644
--- a/webinterface.py
+++ b/webinterface.py
@@ -5339,15 +5339,35 @@ 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():
- htmlStr += '' + \
- '' + item[0] + ''
- htmlStr += '
'
+ if 'vote:' + nickname in item[2]:
+ htmlStr += '' + \
+ '' + item[0] + ''
+ if moderator:
+ htmlStr += \
+ '
'
+ else:
+ htmlStr += '
'
+ else:
+ htmlStr += '' + \
+ '' + item[0] + ''
+ if moderator:
+ htmlStr += \
+ '
'
+ else:
+ htmlStr += ' '
return htmlStr
@@ -5426,7 +5446,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
else:
htmlStr += '
\n'
- htmlStr += htmlNewswire(newswire)
+ htmlStr += htmlNewswire(newswire, nickname, moderator)
return htmlStr