Alternate between profile and timeline by selecting header

master
Bob Mottram 2019-07-30 13:03:40 +01:00
parent 65e2ee0708
commit 6c471f48cc
2 changed files with 10 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -300,10 +300,14 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
followApprovalsSection='' followApprovalsSection=''
followApprovals='' followApprovals=''
linkToTimelineStart=''
linkToTimelineEnd=''
if not authorized: if not authorized:
loginButton='<br><a href="/login"><button class="loginButton">Login</button></a>' loginButton='<br><a href="/login"><button class="loginButton">Login</button></a>'
else: else:
linkToTimelineStart='<a href="/users/'+nickname+'/inbox">'
linkToTimelineEnd='</a>'
# are there any follow requests? # are there any follow requests?
followRequestsFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/followrequests.txt' followRequestsFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/followrequests.txt'
if os.path.isfile(followRequestsFilename): if os.path.isfile(followRequestsFilename):
@ -334,6 +338,7 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
actor=profileJson['id'] actor=profileJson['id']
profileStr= \ profileStr= \
linkToTimelineStart+ \
' <div class="hero-image">' \ ' <div class="hero-image">' \
' <div class="hero-text">' \ ' <div class="hero-text">' \
' <img src="'+profileJson['icon']['url']+'" alt="'+nickname+'@'+domainFull+'">' \ ' <img src="'+profileJson['icon']['url']+'" alt="'+nickname+'@'+domainFull+'">' \
@ -342,7 +347,8 @@ def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
' <p>'+profileDescription+'</p>'+ \ ' <p>'+profileDescription+'</p>'+ \
loginButton+ \ loginButton+ \
' </div>' \ ' </div>' \
'</div>' \ '</div>'+ \
linkToTimelineEnd+ \
'<div class="container">\n' \ '<div class="container">\n' \
' <center>' \ ' <center>' \
' <a href="'+actor+'"><button class="'+postsButton+'"><span>Posts </span></button></a>' \ ' <a href="'+actor+'"><button class="'+postsButton+'"><span>Posts </span></button></a>' \
@ -523,13 +529,14 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
tlStr=htmlHeader(profileStyle) tlStr=htmlHeader(profileStyle)
tlStr+= \ tlStr+= \
'<a href="/users/'+nickname+'">' \
'<div class="timeline-banner">' \ '<div class="timeline-banner">' \
'</div>' \ '</div></a>' \
'<div class="container">\n'+ \ '<div class="container">\n'+ \
' <a href="'+actor+'/inbox"><button class="'+inboxButton+'"><span>Inbox </span></button></a>' \ ' <a href="'+actor+'/inbox"><button class="'+inboxButton+'"><span>Inbox </span></button></a>' \
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>Sent </span></button></a>' \ ' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>Sent </span></button></a>' \
' <a href="'+actor+'/newpost"><img src="/icons/newpost.png" title="Create a new post" alt="Create a new post" class="right"/></a>'+ \ ' <a href="'+actor+'/newpost"><img src="/icons/newpost.png" title="Create a new post" alt="Create a new post" class="right"/></a>'+ \
' <a href="'+actor+'/newfollow"><img src="/icons/add.png" title="Add a new follow" alt="Add a new follow" class="right"/></a>'+ \ ' <a href="'+actor+'/search"><img src="/icons/search.png" title="Search and follow" alt="Search and follow" class="right"/></a>'+ \
followApprovals+ \ followApprovals+ \
'</div>' '</div>'
for item in timelineJson['orderedItems']: for item in timelineJson['orderedItems']: