Add post icons

master
Bob Mottram 2019-07-30 13:47:42 +01:00
parent 6c471f48cc
commit ce0bd875f5
5 changed files with 49 additions and 11 deletions

View File

@ -199,11 +199,6 @@ body, html {
margin: 10px 0;
}
.darker {
border-color: #ccc;
background-color: #ddd;
}
.container::after {
content: "";
clear: both;
@ -218,6 +213,27 @@ body, html {
border-radius: 10%;
}
.containericons {
border: 0px solid #dedede;
background-color: #f1f1f1;
border-radius: 5px;
padding: 10px;
margin: 10px 0;
}
.darker {
border-color: #ccc;
background-color: #ddd;
}
.containericons img {
float: right;
max-width: 35px;
width: 5%;
margin-right: 50px;
border-radius: 10%;
}
.container img.attachment {
max-width: 100%;
margin-left: 25%;
@ -229,15 +245,22 @@ body, html {
margin-left: 20px;
margin-right:0;
}
.containericons img.right {
float: right;
margin-left: 20px;
margin-right:0;
}
.time-right {
float: right;
color: #aaa;
margin:10px 30px;
}
.time-left {
float: left;
color: #999;
margin:10px 0px;
}
.post-title {

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
img/icons/reply.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -198,7 +198,7 @@ def htmlProfilePosts(baseDir: str,httpPrefix: str, \
if item['type']=='Create':
profileStr+= \
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
nickname,domain,port,item)
nickname,domain,port,item,False)
return profileStr
def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
@ -412,14 +412,17 @@ def individualFollowAsHtml(session,wfRequest: {}, \
def individualPostAsHtml(baseDir: str, \
session,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int, \
postJsonObject: {}) -> str:
postJsonObject: {}, \
showIcons=False) -> str:
avatarPosition=''
containerClass='container'
containerClassIcons='containericons'
timeClass='time-right'
actorNickname=getNicknameFromActor(postJsonObject['actor'])
actorDomain,actorPort=getDomainFromActor(postJsonObject['actor'])
titleStr='@'+actorNickname+'@'+actorDomain
if postJsonObject['object']['inReplyTo']:
containerClassIcons='containericons darker'
containerClass='container darker'
avatarPosition=' class="right"'
timeClass='time-left'
@ -490,13 +493,21 @@ def individualPostAsHtml(baseDir: str, \
' </div>' \
' </div>'
footerStr='<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'
if showIcons:
footerStr='<div class="'+containerClassIcons+'">'
footerStr+='<img src="/icons/reply.png"/>'
footerStr+='<img src="/icons/repeat_inactive.png"/>'
footerStr+='<img src="/icons/like_inactive.png"/>'
footerStr+='<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>'
footerStr+='</div>'
return \
'<div class="'+containerClass+'">\n'+ \
avatarDropdown+ \
'<p class="post-title">'+titleStr+'</p>'+ \
postJsonObject['object']['content']+'\n'+ \
attachmentStr+ \
'<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \
attachmentStr+footerStr+ \
'</div>\n'
def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
@ -517,6 +528,10 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
sentButton='buttonselected'
actor='/users/'+nickname
showIndividualPostIcons=True
if boxName=='inbox':
showIndividualPostIcons=True
followApprovals=''
followRequestsFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/followrequests.txt'
if os.path.isfile(followRequestsFilename):
@ -542,7 +557,7 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
for item in timelineJson['orderedItems']:
if item['type']=='Create':
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
nickname,domain,port,item)
nickname,domain,port,item,showIndividualPostIcons)
tlStr+=htmlFooter()
return tlStr
@ -566,7 +581,7 @@ def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \
"""
return htmlHeader()+ \
individualPostAsHtml(baseDir,session,wfRequest,personCache, \
nickname,domain,port,postJsonObject)+ \
nickname,domain,port,postJsonObject,False)+ \
htmlFooter()
def htmlPostReplies(postJsonObject: {}) -> str: