modified: routes/auth_routes.py

modified:   routes/journal_routes.py
	modified:   static/css/style.css
	modified:   templates/base.html
	new file:   templates/datenschutz.html
	modified:   templates/future.html
	new file:   templates/impressum.html
This commit is contained in:
SimolZimol
2026-08-02 21:46:25 +02:00
parent 25d35e5556
commit 29cadb7fd3
7 changed files with 260 additions and 10 deletions

View File

@@ -33,3 +33,15 @@ def logout():
session.clear()
flash("Du wurdest abgemeldet.", "info")
return redirect(url_for("auth.login"))
@auth_bp.route("/impressum")
def impressum():
"""Öffentliche Impressum-Seite (gesetzlich Pflicht)."""
return render_template("impressum.html")
@auth_bp.route("/datenschutz")
def datenschutz():
"""Öffentliche Datenschutz-/GDPR-Seite."""
return render_template("datenschutz.html")

View File

@@ -277,13 +277,19 @@ def future():
note_text = request.form.get("note_text", "").strip()
month_str = request.form.get("month", "")
month = parse_date(month_str)
ref_type = request.form.get("ref_type", "").strip()
ref_value = request.form.get("ref_value", "").strip()
refs = None
if ref_value:
refs = json.dumps([{"type": ref_type or "link", "value": ref_value}])
if note_text and month:
with get_connection() as conn:
with conn.cursor() as cur:
cur.execute(
"INSERT INTO future_log (user_id, month_date, note_text) "
"VALUES (%s, %s, %s)",
(_user_id(), month, note_text),
"INSERT INTO future_log (user_id, month_date, note_text, refs) "
"VALUES (%s, %s, %s, %s)",
(_user_id(), month, note_text, refs),
)
flash("Eintrag ins Future Log hinzugefügt.", "success")
else:
@@ -298,13 +304,52 @@ def future():
)
entries = cur.fetchall()
# Gruppieren nach Monat
# Gruppieren nach Monat (mit Zählern)
grouped = {}
for e in entries:
key = e["month_date"].strftime("%Y-%m")
grouped.setdefault(key, []).append(e)
return render_template("future.html", grouped=grouped, months=MONTHS)
month_stats = {}
for key, items in grouped.items():
month_stats[key] = {
"total": len(items),
"open": sum(1 for i in items if i["status"] == "open"),
"done": sum(1 for i in items if i["status"] == "done"),
}
today = date.today()
return render_template(
"future.html",
grouped=grouped,
month_stats=month_stats,
months=MONTHS,
ref_types=list(REF_TYPE_DISPLAY.keys()),
today_str=today.strftime("%Y-%m"),
)
@journal_bp.route("/future/<int:entry_id>/toggle", methods=["POST"])
@login_required
def toggle_future(entry_id: int):
"""Schaltet einen Future-Log-Eintrag zwischen offen und erledigt um."""
with get_connection() as conn:
with conn.cursor() as cur:
cur.execute(
"SELECT status FROM future_log WHERE id = %s AND user_id = %s",
(entry_id, _user_id()),
)
entry = cur.fetchone()
if not entry:
flash("Eintrag nicht gefunden.", "danger")
return redirect(url_for("journal.future"))
new_status = "done" if entry["status"] != "done" else "open"
cur.execute(
"UPDATE future_log SET status = %s WHERE id = %s AND user_id = %s",
(new_status, entry_id, _user_id()),
)
flash("Status aktualisiert.", "success")
return redirect(url_for("journal.future"))
@journal_bp.route("/woche")