From 226996c04214dfd9b870a9ef77e1d7820f91d04a Mon Sep 17 00:00:00 2001 From: OMN Date: Thu, 19 Nov 2020 10:49:18 +0000 Subject: [PATCH] Continue refactoring for News instances --- webapp_timeline.py | 125 ++++++++++++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 35 deletions(-) diff --git a/webapp_timeline.py b/webapp_timeline.py index b9468325..60ef99c9 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -122,16 +122,44 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, # Banner and "profile toggle" link + tlStr += '
\n' + # TODO: This CSS should be moved out of the code # Items like this that can be different per user should be kept # in the user's folder and loaded as final CSS, to allow overwrite(s) - tlStr += (f"\t" - f"{translate['Switch to profile view']}\n") + if not newsHeader: + tlStr += (f"\t" + f"{translate['Switch to profile view']}\n") + else: + # TODO: News instances should ignore personalised banners + # Currently uses the 'news' actor banner - as it remains unchanged + tlStr += (f"\t" + f"{translate['News']}\n") + + tlStr += '
\n' - # Full Row of Buttons - if fullWidthTimelineButtonHeader: + # TODO: Include '/editprofile' link on 'User' page for 'News' instances + + + # Full row "navbar" + if defaultTimeline == 'tlnews': + # Show "tab" links instead of standard "buttons" + tlStr += headerNewsTabs(boxName, translate, usersPath, moderator, baseDir) + + # Only show standard "buttons" on 'inbox' page + if boxName == 'inbox': + tlStr += \ + headerButtonsTimeline(defaultTimeline, boxName, pageNumber, + translate, usersPath, + minimal, moderator, + manuallyApproveFollowers, + baseDir, nickname, + domain, timelineStartTime, + iconsAsButtons) + elif fullWidthTimelineButtonHeader: tlStr += \ headerButtonsTimeline(defaultTimeline, boxName, pageNumber, translate, usersPath, @@ -152,12 +180,12 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, httpPrefix, translate, editor, False, None, rssIconAtTop, True, False) - tlStr += '
\n' + \ + tlStr += ' \n' # center column containing posts - tlStr += '
\n' + tlStr += '
\n' - if not fullWidthTimelineButtonHeader: + if not defaultTimeline == 'tlnews' and not fullWidthTimelineButtonHeader: tlStr += \ headerButtonsTimeline(defaultTimeline, boxName, pageNumber, translate, usersPath, @@ -347,7 +375,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, showPublishAsIcon, rssIconAtTop, publishButtonAtTop, authorized, True) - tlStr += '
' + \ + tlStr += '
' + \ rightColumnStr + '
\n' _logTimelineTiming(enableTimingLog, timelineStartTime, boxName, '9') @@ -524,30 +552,6 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr = '\t
\n' - # TODO: Fix that the following two bools are equivalent - # - Pick one and move on - # if this is a news instance and we are viewing the news timeline - newsHeader = False - if defaultTimeline == 'tlnews' and boxName == 'tlnews': - newsHeader = True - isFeaturesTimeline = \ - defaultTimeline == 'tlnews' and boxName == 'tlnews' - - -# TODO: Easiest solution for News instance tab links -# - Simply hide the button row -# - Draw a separate
just for News tabs -# if newsHeader: -# tlStr += \ -# '' + \ -# '' -# tlStr += \ -# '' + \ -# '' - - # TODO: Group _all_ items that are hidden in 'minimal' mode ? # - Are there others elsewhere in the code ? @@ -654,7 +658,7 @@ def headerButtonsTimeline(defaultTimeline: str, # Generate HTML list navButtonStr = '\t\t