Show navigation icons

main
Bob Mottram 2020-02-25 18:19:43 +00:00
parent fac248ee3b
commit 99a8a41cea
2 changed files with 40 additions and 8 deletions

34
blog.py
View File

@ -93,7 +93,9 @@ def htmlBlogPostContent(baseDir: str,httpPrefix: str,translate: {}, \
blogStr+='<br><center>'+attachmentStr+'</center>'
if postJsonObject['object'].get('content'):
contentStr=addEmbeddedElements(translate,postJsonObject['object']['content'])
contentStr= \
addEmbeddedElements(translate, \
postJsonObject['object']['content'])
if postJsonObject['object'].get('tag'):
contentStr= \
replaceEmojiFromTags(contentStr, \
@ -153,13 +155,6 @@ def htmlBlogPage(session, \
if not os.path.isfile(blogsIndex):
return blogStr+htmlFooter()
if pageNumber:
if pageNumber>1:
# show previous button
print('TODO previous')
# show next button
print('TODO next')
timelineJson= \
createBlogsTimeline(session,baseDir, \
nickname,domain,port,httpPrefix, \
@ -173,6 +168,26 @@ def htmlBlogPage(session, \
if port!=80 and port!=443:
domainFull=domain+':'+str(port)
if pageNumber:
iconsDir=getIconsDir(baseDir)
navigateStr='<p>'
if pageNumber>1:
# show previous button
navigateStr+= \
'<a href="'+httpPrefix+'://'+domainFull+'/blog/'+nickname+'?page='+str(pageNumber-1)+'">'+ \
'<img loading="lazy" alt="<" title="<" '+ \
'src="/'+iconsDir+ \
'/prev.png" class="buttonprev"/></a>\n'
if len(timelineJson['orderedItems'])>=noOfItems:
# show next button
navigateStr+= \
'<a href="'+httpPrefix+'://'+domainFull+'/blog/'+nickname+'?page='+str(pageNumber+1)+'">'+ \
'<img loading="lazy" alt=">" title=">" '+ \
'src="/'+iconsDir+ \
'/prev.png" class="buttonnext"/></a>\n'
navigateStr='</p>'
blogStr+=navigateStr
for item in timelineJson['orderedItems']:
if item['type']!='Create':
continue
@ -182,6 +197,9 @@ def htmlBlogPage(session, \
nickname,domain,domainFull,item, \
None,True)
if len(timelineJson['orderedItems'])>=noOfItems:
blogStr+=navigateStr
return blogStr+htmlFooter()
return None

View File

@ -91,3 +91,17 @@ img {
img:hover {
box-shadow: 0 0 2px 1px var(--gallery-hover);
}
.buttonprev {
float: left;
width: 10%;
-ms-transform: translateY(30%);
transform: translateY(30%);
}
.buttonnext {
float: right;
width: 10%;
-ms-transform: translateY(30%) scaleX(-1);
transform: translateY(30%) scaleX(-1);
}