Add banner to conversation view so that it's easier to go back to the timeline using keyboard navigation

merge-requests/30/head
Bob Mottram 2024-06-20 12:44:13 +01:00
parent 9dd546b85c
commit 132303b04f
4 changed files with 26 additions and 5 deletions

View File

@ -625,7 +625,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites, self.server.buy_sites,
self.server.blocked_cache, self.server.blocked_cache,
self.server.block_federated, self.server.block_federated,
self.server.auto_cw_cache): self.server.auto_cw_cache,
self.server.default_timeline):
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_conversation_thread', '_GET', '_show_conversation_thread',
self.server.debug) self.server.debug)

View File

@ -1273,7 +1273,8 @@ def show_conversation_thread(self, authorized: bool,
buy_sites: [], buy_sites: [],
blocked_cache: {}, blocked_cache: {},
block_federated: {}, block_federated: {},
auto_cw_cache: {}) -> bool: auto_cw_cache: {},
default_timeline: str) -> bool:
"""get conversation thread from the date link on a post """get conversation thread from the date link on a post
""" """
if not path.startswith('/users/'): if not path.startswith('/users/'):
@ -1334,7 +1335,8 @@ def show_conversation_thread(self, authorized: bool,
blocked_cache, blocked_cache,
block_federated, block_federated,
auto_cw_cache, auto_cw_cache,
ua_str) ua_str,
default_timeline)
if conv_str: if conv_str:
msg = conv_str.encode('utf-8') msg = conv_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)

View File

@ -21,6 +21,7 @@ from webapp_utils import text_mode_browser
from webapp_utils import html_header_with_external_style from webapp_utils import html_header_with_external_style
from webapp_utils import html_post_separator from webapp_utils import html_post_separator
from webapp_utils import html_footer from webapp_utils import html_footer
from webapp_utils import get_banner_file
from webapp_post import individual_post_as_html from webapp_post import individual_post_as_html
@ -53,7 +54,8 @@ def html_conversation_view(authorized: bool, post_id: str,
blocked_cache: [], blocked_cache: [],
block_federated: [], block_federated: [],
auto_cw_cache: {}, auto_cw_cache: {},
ua_str: str) -> str: ua_str: str,
default_timeline: str) -> str:
"""Show a page containing a conversation thread """Show a page containing a conversation thread
""" """
conv_posts = \ conv_posts = \
@ -74,6 +76,22 @@ def html_conversation_view(authorized: bool, post_id: str,
conv_str = \ conv_str = \
html_header_with_external_style(css_filename, instance_title, None) html_header_with_external_style(css_filename, instance_title, None)
# banner and row of buttons
users_path = '/users/' + nickname
banner_file, _ = get_banner_file(base_dir, nickname, domain, theme_name)
conv_str += \
'<header>\n' + \
' <a href="/users/' + nickname + '/' + \
default_timeline + '" title="' + \
translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '" ' + \
'aria-flowto="containerHeader" tabindex="1" accesskey="' + \
access_keys['menuTimeline'] + '">\n'
conv_str += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" alt="" ' + \
'src="' + users_path + '/' + banner_file + '" /></a>\n' + \
'</header>\n'
separator_str = html_post_separator(base_dir, None) separator_str = html_post_separator(base_dir, None)
text_mode_separator = '<div class="transparent"><hr></div>\n' text_mode_separator = '<div class="transparent"><hr></div>\n'

View File

@ -793,7 +793,7 @@ def html_timeline(default_timeline: str,
# banner and row of buttons # banner and row of buttons
tl_str += \ tl_str += \
'<header>\n' + \ '<header>\n' + \
'<a href="/users/' + nickname + '" title="' + \ ' <a href="/users/' + nickname + '" title="' + \
translate['Switch to profile view'] + '" alt="' + \ translate['Switch to profile view'] + '" alt="' + \
translate['Switch to profile view'] + '" ' + \ translate['Switch to profile view'] + '" ' + \
'aria-flowto="containerHeader" tabindex="1" accesskey="' + \ 'aria-flowto="containerHeader" tabindex="1" accesskey="' + \