Show map button on calendar

main
bashrc 2026-02-26 09:28:14 +00:00
parent e0e829360d
commit 41d395c87d
3 changed files with 19 additions and 12 deletions

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Calendar"
import os
from auth import create_password
from datetime import datetime
from datetime import date
from utils import browser_supports_download_filename
@ -30,6 +31,7 @@ from happening import get_todays_events
from happening import get_calendar_events
from happening import get_todays_events_icalendar
from happening import get_month_events_icalendar
from webapp_utils import get_show_map_button
from webapp_utils import get_banner_file
from webapp_utils import set_custom_background
from webapp_utils import html_header_with_external_style
@ -251,7 +253,11 @@ def _html_calendar_day(person_cache: {}, translate: {},
session_yggdrasil,
'320', '320')
if event_map:
event_place = event_map
if not post_id:
post_id = 'post' + str(create_password(8))
event_place = \
get_show_map_button(post_id, translate,
event_map)
# prepend a link to the sender of the calendar item
if sender_name and event_description:

View File

@ -107,6 +107,7 @@ from content import add_auto_cw
from person import is_person_snoozed
from person import get_person_avatar_url
from textmode import text_mode_browser
from webapp_utils import get_show_map_button
from webapp_utils import mitm_warning_html
from webapp_utils import get_buy_links
from webapp_utils import get_banner_file
@ -2316,16 +2317,6 @@ def _mentions_to_person_options(html_str: str, nickname: str, domain: str,
return html_str
def _get_show_map_button(post_id: str, translate: {},
map_content: str) -> str:
"""Returns the markup for a "show map" button
"""
return ' <details><summary class="cw" tabindex="10">' + \
translate['Show Map'] + '</summary>' + \
'<div id="' + post_id + '">' + map_content + \
'</div></details>\n'
def individual_post_as_html(signing_priv_key_pem: str,
allow_downloads: bool,
recent_posts_cache: {}, max_recent_posts: int,
@ -3441,7 +3432,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
if map_str:
if not post_id:
post_id = 'post' + str(create_password(8))
map_str = _get_show_map_button(post_id, translate, map_str)
map_str = get_show_map_button(post_id, translate, map_str)
post_html += \
content_str + citations_str + map_str + \

View File

@ -271,6 +271,16 @@ def get_content_warning_button(post_id: str, translate: {},
'</div></details>\n'
def get_show_map_button(post_id: str, translate: {},
map_content: str) -> str:
"""Returns the markup for a "show map" button
"""
return ' <details><summary class="cw" tabindex="10">' + \
translate['Show Map'] + '</summary>' + \
'<div id="' + post_id + '">' + map_content + \
'</div></details>\n'
def open_content_warning(text: str, translate: {}) -> str:
"""Opens content warning when replying to a post with a cw
so that you can see what you are replying to