diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index a4e7b1b22..d8e7e5b90 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -15,81 +15,12 @@ from webapp_utils import htmlFooter from webapp_utils import getIconsWebPath from webapp_utils import getBannerFile from webapp_utils import htmlPostSeparator +from webapp_utils import headerButtonsFrontScreen from webapp_column_left import getLeftColumnContent from webapp_column_right import getRightColumnContent from webapp_post import individualPostAsHtml -def headerButtonsFrontScreen(translate: {}, - nickname: str, boxName: str, - authorized: bool, - iconsAsButtons: bool, - iconsPath: bool) -> str: - """Returns the header buttons for the front page of a news instance - """ - headerStr = '' - if nickname == 'news': - buttonFeatures = 'buttonMobile' - buttonNewswire = 'buttonMobile' - buttonLinks = 'buttonMobile' - if boxName == 'features': - buttonFeatures = 'buttonselected' - elif boxName == 'newswire': - buttonNewswire = 'buttonselected' - elif boxName == 'links': - buttonLinks = 'buttonselected' - - headerStr += \ - ' ' + \ - '' - if not authorized: - headerStr += \ - ' ' + \ - '' - if iconsAsButtons: - headerStr += \ - ' ' + \ - '' - headerStr += \ - ' ' + \ - '' - else: - headerStr += \ - ' ' + \ - '| ' + translate['Newswire'] + '\n' - headerStr += \ - ' ' + \ - '| ' + translate['Links'] + '\n' - else: - if not authorized: - headerStr += \ - ' ' + \ - '' - - if headerStr: - headerStr = \ - '\n
\n' + \ - headerStr + \ - '
\n' - return headerStr - - def htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int, translate: {}, baseDir: str, httpPrefix: str, diff --git a/webapp_utils.py b/webapp_utils.py index 0c8698231..e704a83f0 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -20,6 +20,76 @@ from content import addHtmlTags from content import replaceEmojiFromTags +def headerButtonsFrontScreen(translate: {}, + nickname: str, boxName: str, + authorized: bool, + iconsAsButtons: bool, + iconsPath: bool) -> str: + """Returns the header buttons for the front page of a news instance + """ + headerStr = '' + if nickname == 'news': + buttonFeatures = 'buttonMobile' + buttonNewswire = 'buttonMobile' + buttonLinks = 'buttonMobile' + if boxName == 'features': + buttonFeatures = 'buttonselected' + elif boxName == 'newswire': + buttonNewswire = 'buttonselected' + elif boxName == 'links': + buttonLinks = 'buttonselected' + + headerStr += \ + ' ' + \ + '' + if not authorized: + headerStr += \ + ' ' + \ + '' + if iconsAsButtons: + headerStr += \ + ' ' + \ + '' + headerStr += \ + ' ' + \ + '' + else: + headerStr += \ + ' ' + \ + '| ' + translate['Newswire'] + '\n' + headerStr += \ + ' ' + \ + '| ' + translate['Links'] + '\n' + else: + if not authorized: + headerStr += \ + ' ' + \ + '' + + if headerStr: + headerStr = \ + '\n
\n' + \ + headerStr + \ + '
\n' + return headerStr + + def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str: """Returns alternate path from the actor eg. https://clearnetdomain/path becomes http://oniondomain/path