News header

main
Bob Mottram 2020-10-26 22:00:54 +00:00
parent 90e5c140cf
commit 3d879081f7
1 changed files with 71 additions and 58 deletions

View File

@ -5996,20 +5996,27 @@ def getTimelineButtonHeader(defaultTimeline: str,
inboxButton + '"><span>' + \ inboxButton + '"><span>' + \
translate['Inbox'] + '</span></button></a>\n' translate['Inbox'] + '</span></button></a>\n'
tlStr += \ # if this is a news instance and we are viewing the news timeline
' <a href="' + usersPath + '/dm"><button class="' + dmButton + \ newsHeader = False
'"><span>' + htmlHighlightLabel(translate['DM'], newDM) + \ if defaultTimeline == 'tlnews' and boxName == 'tlnews':
'</span></button></a>\n' newsHeader = True
tlStr += \ if not newsHeader:
' <a href="' + usersPath + '/tlreplies"><button class="' + \ tlStr += \
repliesButton + '"><span>' + \ ' <a href="' + usersPath + \
htmlHighlightLabel(translate['Replies'], newReply) + \ '/dm"><button class="' + dmButton + \
'</span></button></a>\n' '"><span>' + htmlHighlightLabel(translate['DM'], newDM) + \
'</span></button></a>\n'
tlStr += \
' <a href="' + usersPath + '/tlreplies"><button class="' + \
repliesButton + '"><span>' + \
htmlHighlightLabel(translate['Replies'], newReply) + \
'</span></button></a>\n'
# typically the media button # typically the media button
if defaultTimeline != 'tlmedia': if defaultTimeline != 'tlmedia':
if not minimal: if not minimal and not newsHeader:
tlStr += \ tlStr += \
' <a href="' + usersPath + \ ' <a href="' + usersPath + \
'/tlmedia"><button class="' + \ '/tlmedia"><button class="' + \
@ -6027,11 +6034,12 @@ def getTimelineButtonHeader(defaultTimeline: str,
# but may change if this is a blogging oriented instance # but may change if this is a blogging oriented instance
if defaultTimeline != 'tlblogs': if defaultTimeline != 'tlblogs':
if not minimal or defaultTimeline == 'tlnews': if not minimal or defaultTimeline == 'tlnews':
tlStr += \ if not newsHeader:
' <a href="' + usersPath + \ tlStr += \
'/tlblogs"><button class="' + \ ' <a href="' + usersPath + \
blogsButton + '"><span>' + translate['Blogs'] + \ '/tlblogs"><button class="' + \
'</span></button></a>\n' blogsButton + '"><span>' + translate['Blogs'] + \
'</span></button></a>\n'
else: else:
if not minimal: if not minimal:
tlStr += \ tlStr += \
@ -6049,23 +6057,25 @@ def getTimelineButtonHeader(defaultTimeline: str,
newsButton + '"><span>' + translate['News'] + \ newsButton + '"><span>' + translate['News'] + \
'</span></button></a>\n' '</span></button></a>\n'
else: else:
if not newsHeader:
tlStr += \
' <a href="' + usersPath + \
'/inbox"><button class="' + \
inboxButton + '"><span>' + translate['Inbox'] + \
'</span></button></a>\n'
if not newsHeader:
# button for the outbox
tlStr += \ tlStr += \
' <a href="' + usersPath + \ ' <a href="' + usersPath + \
'/inbox"><button class="' + \ '/outbox"><button class="' + \
inboxButton + '"><span>' + translate['Inbox'] + \ sentButton + '"><span>' + translate['Outbox'] + \
'</span></button></a>\n' '</span></button></a>\n'
# button for the outbox # add other buttons
tlStr += \ tlStr += \
' <a href="' + usersPath + \ sharesButtonStr + bookmarksButtonStr + eventsButtonStr + \
'/outbox"><button class="' + \ moderationButtonStr + newPostButtonStr
sentButton + '"><span>' + translate['Outbox'] + \
'</span></button></a>\n'
# add other buttons
tlStr += \
sharesButtonStr + bookmarksButtonStr + eventsButtonStr + \
moderationButtonStr + newPostButtonStr
# show todays events buttons on the first inbox page # show todays events buttons on the first inbox page
if boxName == 'inbox' and pageNumber == 1: if boxName == 'inbox' and pageNumber == 1:
@ -6114,20 +6124,21 @@ def getTimelineButtonHeader(defaultTimeline: str,
'/calendar"><button class="button">' + \ '/calendar"><button class="button">' + \
translate['Happening This Week'] + '</button></a>\n' translate['Happening This Week'] + '</button></a>\n'
if not iconsAsButtons: if not newsHeader:
# the search button if not iconsAsButtons:
tlStr += \ # the search button
' <a class="imageAnchor" href="' + usersPath + \ tlStr += \
'/search"><img loading="lazy" src="/' + \ ' <a class="imageAnchor" href="' + usersPath + \
iconsDir + '/search.png" title="' + \ '/search"><img loading="lazy" src="/' + \
translate['Search and follow'] + '" alt="| ' + \ iconsDir + '/search.png" title="' + \
translate['Search and follow'] + '" class="timelineicon"/></a>\n' translate['Search and follow'] + '" alt="| ' + \
else: translate['Search and follow'] + '" class="timelineicon"/></a>\n'
tlStr += \ else:
' <a href="' + usersPath + \ tlStr += \
'/search"><button class="button">' + \ ' <a href="' + usersPath + \
'<span>' + translate['Search'] + \ '/search"><button class="button">' + \
'</span></button></a>\n' '<span>' + translate['Search'] + \
'</span></button></a>\n'
# benchmark 5 # benchmark 5
timeDiff = int((time.time() - timelineStartTime) * 1000) timeDiff = int((time.time() - timelineStartTime) * 1000)
@ -6154,21 +6165,22 @@ def getTimelineButtonHeader(defaultTimeline: str,
'<span>' + translate['Calendar'] + \ '<span>' + translate['Calendar'] + \
'</span></button></a>\n' '</span></button></a>\n'
# the show/hide button, for a simpler header appearance if not newsHeader:
if not iconsAsButtons: # the show/hide button, for a simpler header appearance
tlStr += \ if not iconsAsButtons:
' <a class="imageAnchor" href="' + \ tlStr += \
usersPath + '/minimal' + \ ' <a class="imageAnchor" href="' + \
'"><img loading="lazy" src="/' + iconsDir + \ usersPath + '/minimal' + \
'/showhide.png" title="' + translate['Show/Hide Buttons'] + \ '"><img loading="lazy" src="/' + iconsDir + \
'" alt="| ' + translate['Show/Hide Buttons'] + \ '/showhide.png" title="' + translate['Show/Hide Buttons'] + \
'" class="timelineicon"/></a>\n' '" alt="| ' + translate['Show/Hide Buttons'] + \
else: '" class="timelineicon"/></a>\n'
tlStr += \ else:
' <a href="' + usersPath + '/minimal' + \ tlStr += \
'"><button class="button">' + \ ' <a href="' + usersPath + '/minimal' + \
'<span>' + translate['Expand'] + \ '"><button class="button">' + \
'</span></button></a>\n' '<span>' + translate['Expand'] + \
'</span></button></a>\n'
# the newswire button to show right column links # the newswire button to show right column links
if not iconsAsButtons: if not iconsAsButtons:
@ -6204,7 +6216,8 @@ def getTimelineButtonHeader(defaultTimeline: str,
'<span>' + translate['Links'] + \ '<span>' + translate['Links'] + \
'</span></button></a>\n' '</span></button></a>\n'
tlStr += followApprovals if not newsHeader:
tlStr += followApprovals
# end of the button header with inbox, outbox, etc # end of the button header with inbox, outbox, etc
tlStr += ' </div>\n' tlStr += ' </div>\n'
return tlStr return tlStr