Option to show icons on the front page button header

merge-requests/8/head
Bob Mottram 2020-10-31 13:33:47 +00:00
parent 10f7cb05a9
commit 247d5a846c
2 changed files with 45 additions and 18 deletions

View File

@ -9519,6 +9519,7 @@ class PubServer(BaseHTTPRequestHandler):
'/users/' + nickname + '/' + self.server.defaultTimeline
showPublishAsIcon = self.server.showPublishAsIcon
rssIconAtTop = self.server.rssIconAtTop
iconsAsButtons = htmlNewswireMobile
msg = htmlNewswireMobile(self.server.cssCache,
self.server.baseDir,
nickname,
@ -9531,7 +9532,8 @@ class PubServer(BaseHTTPRequestHandler):
timelinePath,
showPublishAsIcon,
authorized,
rssIconAtTop).encode('utf-8')
rssIconAtTop,
iconsAsButtons).encode('utf-8')
self._set_headers('text/html', len(msg),
cookie, callingDomain)
self._write(msg)
@ -9551,6 +9553,7 @@ class PubServer(BaseHTTPRequestHandler):
return
timelinePath = \
'/users/' + nickname + '/' + self.server.defaultTimeline
iconsAsButtons = self.server.iconsAsButtons
msg = htmlLinksMobile(self.server.cssCache,
self.server.baseDir, nickname,
self.server.domainFull,
@ -9558,7 +9561,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate,
timelinePath,
authorized,
self.server.rssIconAtTop).encode('utf-8')
self.server.rssIconAtTop,
iconsAsButtons).encode('utf-8')
self._set_headers('text/html', len(msg), cookie, callingDomain)
self._write(msg)
self.server.GETbusy = False

View File

@ -3409,7 +3409,8 @@ def htmlProfile(rssIconAtTop: bool,
iconsDir = getIconsDir(baseDir)
if not authorized:
loginButton = headerButtonsFrontScreen(translate, nickname,
'features', authorized)
'features', authorized,
iconsAsButtons, iconsDir)
else:
editProfileStr = \
'<a class="imageAnchor" href="' + usersPath + '/editprofile">' + \
@ -5891,7 +5892,8 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
nickname: str, domainFull: str,
httpPrefix: str, translate,
timelinePath: str, authorized: bool,
rssIconAtTop: bool) -> str:
rssIconAtTop: bool,
iconsAsButtons: bool) -> str:
"""Show the left column links within mobile view
"""
htmlStr = ''
@ -5922,7 +5924,8 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
htmlStr += '<center>' + \
headerButtonsFrontScreen(translate, nickname,
'links', authorized) + '</center>'
'links', authorized,
iconsAsButtons, iconsDir) + '</center>'
htmlStr += \
getLeftColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate,
@ -5941,7 +5944,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
timelinePath: str,
showPublishAsIcon: bool,
authorized: bool,
rssIconAtTop: bool) -> str:
rssIconAtTop: bool,
iconsAsButtons: bool) -> str:
"""Shows the mobile version of the newswire right column
"""
htmlStr = ''
@ -5979,7 +5983,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
htmlStr += '<center>' + \
headerButtonsFrontScreen(translate, nickname,
'newswire', authorized) + '</center>'
'newswire', authorized,
iconsAsButtons, iconsDir) + '</center>'
htmlStr += \
getRightColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate,
@ -6019,7 +6024,9 @@ def getBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str):
def headerButtonsFrontScreen(translate: {},
nickname: str, boxName: str,
authorized: bool) -> str:
authorized: bool,
iconsAsButtons: bool,
iconsDir: bool) -> str:
"""Returns the header buttons for the front page of a news instance
"""
headerStr = ''
@ -6045,16 +6052,32 @@ def headerButtonsFrontScreen(translate: {},
'<button class="buttonMobile">' + \
'<span>' + translate['Login'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/newswiremobile">' + \
'<button class="' + buttonNewswire + '">' + \
'<span>' + translate['Newswire'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/linksmobile">' + \
'<button class="' + buttonLinks + '">' + \
'<span>' + translate['Links'] + \
'</span></button></a>\n'
if iconsAsButtons:
headerStr += \
' <a href="/users/news/newswiremobile">' + \
'<button class="' + buttonNewswire + '">' + \
'<span>' + translate['Newswire'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/linksmobile">' + \
'<button class="' + buttonLinks + '">' + \
'<span>' + translate['Links'] + \
'</span></button></a>\n'
else:
headerStr += \
' <a class="imageAnchorMobile" href="' + \
'/users/news/newswiremobile">' + \
'<img loading="lazy" src="/' + iconsDir + \
'/newswire.png" title="' + translate['Newswire'] + \
'" alt="| ' + translate['Newswire'] + \
'" class="timelineicon"/></a>\n'
headerStr += \
' <a class="imageAnchorMobile" href="' + \
'/users/news/linksmobile">' + \
'<img loading="lazy" src="/' + iconsDir + \
'/links.png" title="' + translate['Links'] + \
'" alt="| ' + translate['Links'] + \
'" class="timelineicon"/></a>\n'
else:
if not authorized:
headerStr += \