Fix: Freunde-Aktivitäten öffnen direkt das Ziel-Item

- friends.py: entry_id für diary + walk Einträge zurückgeben
- diary.js: openDetail(id) öffentlich gemacht
- friends.js: App.callModule('diary','openDetail',id) bzw.
  App.callModule('walks','openDetail',id) statt nur App.navigate(page)
This commit is contained in:
rene 2026-04-19 11:01:31 +02:00
parent 6809cfae23
commit f9e2202ac7
5 changed files with 20 additions and 6 deletions

View file

@ -224,6 +224,7 @@ async def get_activity(user=Depends(get_current_user)):
diary_rows = conn.execute(f""" diary_rows = conn.execute(f"""
SELECT SELECT
'diary' AS type, 'diary' AS type,
dg.id AS entry_id,
u.id AS user_id, u.id AS user_id,
u.name AS user_name, u.name AS user_name,
u.avatar_url, u.avatar_url,
@ -261,6 +262,7 @@ async def get_activity(user=Depends(get_current_user)):
walk_rows = conn.execute(f""" walk_rows = conn.execute(f"""
SELECT SELECT
'walk' AS type, 'walk' AS type,
w.id AS entry_id,
u.id AS user_id, u.id AS user_id,
u.name AS user_name, u.name AS user_name,
u.avatar_url, u.avatar_url,
@ -310,6 +312,7 @@ async def get_activity(user=Depends(get_current_user)):
t = d["type"] t = d["type"]
items.append({ items.append({
"type": t, "type": t,
"entry_id": d.get("entry_id"),
"user_id": d["user_id"], "user_id": d["user_id"],
"user_name": d["user_name"], "user_name": d["user_name"],
"avatar_url": d.get("avatar_url"), "avatar_url": d.get("avatar_url"),

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung. Router, State-Management, Navigation, Initialisierung.
============================================================ */ ============================================================ */
const APP_VER = '219'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VER = '220'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const App = (() => { const App = (() => {

View file

@ -1187,6 +1187,6 @@ window.Page_diary = (() => {
.trim(); .trim();
} }
return { init, refresh, openNew, onDogChange }; return { init, refresh, openNew, onDogChange, openDetail: _openDetail };
})(); })();

View file

@ -249,8 +249,17 @@ window.Page_friends = (() => {
el.querySelectorAll('.fr-activity-item[data-nav]').forEach(btn => { el.querySelectorAll('.fr-activity-item[data-nav]').forEach(btn => {
btn.addEventListener('click', () => { btn.addEventListener('click', () => {
const page = btn.dataset.nav; const page = btn.dataset.nav;
if (page) App.navigate(page); const entryId = btn.dataset.entryId ? parseInt(btn.dataset.entryId) : null;
const type = btn.dataset.type;
if (!page) return;
if (entryId && type === 'diary') {
App.callModule('diary', 'openDetail', entryId);
} else if (entryId && type === 'walk') {
App.callModule('walks', 'openDetail', entryId);
} else {
App.navigate(page);
}
}); });
}); });
} }
@ -283,7 +292,9 @@ window.Page_friends = (() => {
const tag = page ? `button type="button"` : `div`; const tag = page ? `button type="button"` : `div`;
return ` return `
<${tag} class="fr-activity-item${page ? ' fr-activity-item--link' : ''}" <${tag} class="fr-activity-item${page ? ' fr-activity-item--link' : ''}"
${page ? `data-nav="${page}"` : ''}> ${page ? `data-nav="${page}"` : ''}
${item.entry_id ? `data-entry-id="${item.entry_id}"` : ''}
data-type="${item.type}">
<div class="fr-activity-avatar-wrap"> <div class="fr-activity-avatar-wrap">
${avatar} ${avatar}
<div class="fr-activity-icon-badge"> <div class="fr-activity-icon-badge">

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache Offline-Cache + Push Notifications + Tile-Cache
============================================================ */ ============================================================ */
const CACHE_VERSION = 'by-v241'; const CACHE_VERSION = 'by-v242';
const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten