diff --git a/routes/auth_routes.py b/routes/auth_routes.py index cc1ee2b..66acafd 100644 --- a/routes/auth_routes.py +++ b/routes/auth_routes.py @@ -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") diff --git a/routes/journal_routes.py b/routes/journal_routes.py index bc9db2e..40c66b7 100644 --- a/routes/journal_routes.py +++ b/routes/journal_routes.py @@ -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//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") diff --git a/static/css/style.css b/static/css/style.css index 50fa686..b3f7cce 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -179,6 +179,19 @@ input:focus, select:focus { outline: 2px solid var(--accent); } /* Footer */ .footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .8rem; } +/* --- Footer Links --- */ +.footer-links { margin-top: .3rem; font-size: .85rem; } +.footer-links a { color: var(--accent-dark); text-decoration: none; } +.footer-links a:hover { text-decoration: underline; } +.footer-links span { margin: 0 .4rem; } + +/* --- Rechtliche Seiten (Impressum/Datenschutz) --- */ +.legal h1 { font-size: 1.5rem; margin-bottom: 1rem; } +.legal h2 { font-size: 1.05rem; margin-top: 1.2rem; } +.legal p, .legal li { line-height: 1.6; } +.legal ul { padding-left: 1.2rem; } +.legal a { color: var(--blue); } + /* Responsive */ @media (max-width: 720px) { .week-grid { grid-template-columns: repeat(2, 1fr); } diff --git a/templates/base.html b/templates/base.html index 9802296..b57829a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -45,7 +45,12 @@ diff --git a/templates/datenschutz.html b/templates/datenschutz.html new file mode 100644 index 0000000..c4b2fd8 --- /dev/null +++ b/templates/datenschutz.html @@ -0,0 +1,91 @@ +{% extends "base.html" %} +{% block title %}Datenschutzerklärung – Journal{% endblock %} +{% block content %} + +{% endblock %} diff --git a/templates/future.html b/templates/future.html index f5b9de2..41dd959 100644 --- a/templates/future.html +++ b/templates/future.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Future Log – Bullet Journal{% endblock %} +{% block title %}Future Log – Journal{% endblock %} {% block content %}
@@ -22,13 +22,38 @@
+
+ + +
{% if grouped %} {% for month_key, entries in grouped.items() %}
-

{{ month_key[5:7]|int }} / {{ month_key[0:4] }}

+
+

{{ month_key[5:7]|int }} / {{ month_key[0:4] }} + {% if month_key == today_str %}aktuell{% endif %} +

+
+ {{ month_stats[month_key].open }} offen + {{ month_stats[month_key].done }} erledigt + {{ month_stats[month_key].total }} gesamt +
+
    {% for e in entries %}
  • @@ -44,9 +69,14 @@ {% endfor %}
{% endif %} - {{ e.month_date.strftime('%m/%Y') }} + {{ e.month_date.strftime('%m/%Y') }} +
+ +
Bearbeiten
@@ -60,7 +90,7 @@ {% endfor %} {% else %}
-

Noch keine Einträge im Future Log.

+

Noch keine Einträge im Future Log. Füge oben deinen ersten Eintrag hinzu.

{% endif %} {% endblock %} diff --git a/templates/impressum.html b/templates/impressum.html new file mode 100644 index 0000000..7a3f847 --- /dev/null +++ b/templates/impressum.html @@ -0,0 +1,54 @@ +{% extends "base.html" %} +{% block title %}Impressum – Journal{% endblock %} +{% block content %} + +{% endblock %}