Option to show icons on the front page button header

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

View File

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