From 4c3e476338c419fc250cbef2dcf1d0f62657589e Mon Sep 17 00:00:00 2001 From: marwin Date: Fri, 2 May 2025 08:01:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20update=20environment=20conf?= =?UTF-8?q?ig=20and=20add=20community=20preview=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + __pycache__/app.cpython-313.pyc | Bin 81359 -> 82082 bytes app.py | 57 +++++++++---- templates/base.html | 14 ++-- templates/community/preview.html | 137 +++++++++++++++++++++++++++++++ 5 files changed, 188 insertions(+), 21 deletions(-) create mode 100644 templates/community/preview.html diff --git a/.env b/.env index 71d708d..6ba4956 100644 --- a/.env +++ b/.env @@ -4,6 +4,7 @@ # Flask FLASK_APP=app.py FLASK_ENV=development +FLASK_DEBUG=1 SECRET_KEY=your-secret-key-replace-in-production # OpenAI API diff --git a/__pycache__/app.cpython-313.pyc b/__pycache__/app.cpython-313.pyc index b59b00102285fb19d1cd7dcb2fdfa1dd10bedae7..6fbf834c37bb4fd2caa7a2a307445a0cadb74078 100644 GIT binary patch delta 5806 zcmb`Ldt6ji9>DMK&fFP>0cPYeFmq>Q0LKADPyq!LpNpv!AQvoQ(g+4b1n~ks&;l!8 zS%#kCN>u83YITLdR9g8oh8854h+ z*N`+GU)4lmveI6arz$nj4O53V(^HM>OQBXLBTN#jJk#+&ssvX)h#s8fSES_$lWocl zi>t8qCBN3K(%yo#uMjPtDx_tBke<&9Q&jd_6|W4HwpP(jRcY%y1?6v&`E+?Ig2j2F zaAArp)(e@Q`gINC-7o?pWEHPj)+jbETPv=``g5bSo!8U)IsR)dwhgX&$C^jP8uD?&uLlafg{(z=A3f}D7luo54G9h7oa zQ3}Va4suHMJ1J@K(9EbTJf7P{^{!RI>cEYHBis@q!fs0HYXT9_OW{^-57oMAg;|P! zT?qfXRpj_Bi8Faakb4!fUT9Eat_eZjqauUVH-;eZrDW1tIw_$k$cg)eb$FilQHp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r0}OWBN?Fmm$y3Ss`1-@_j5eeIsQm{W4_usR+oEsZ1Y>O<%f9<@U}wJF&NHeM}!r z$8^VCItHdF#bf3!`N9u|5`?z9N~;?sc5C^d?I5l!1=N zE8h6NB~V pW;@;v?^3#2J9V9osAHL%c5NLnH`9Y^M=>`?Y4Gta)>s#z`yafl0!07- diff --git a/app.py b/app.py index 5f32566..4fff948 100644 --- a/app.py +++ b/app.py @@ -1477,20 +1477,49 @@ def refresh_mindmap(): 'error': 'Datenbankverbindung konnte nicht hergestellt werden' }), 500 - # Route zur Mindmap HTML-Seite @app.route('/mindmap') def mindmap_page(): return render_template('mindmap.html') -# Community-Forum-Routen +# Weiterleitung für Groß-/Kleinschreibung +@app.route('/Community') +def Community(): + # Direkte Umleitung ohne url_for zu verwenden, um Kreisverweise zu vermeiden + return redirect('/') + +# Vermeidung der direkten Community-Route, die Probleme verursacht @app.route('/community') -@login_required def community(): - """Hauptseite des Community-Forums""" - forum_categories = ForumCategory.query.filter_by(is_active=True).all() + """Vermeidet direkten Zugriff auf Community-Forum""" + return redirect('/') + +# Alternative Route für Community-Forum, die über das Menü erreichbar ist +@app.route('/forum') +def forum(): + """Alternative Route zum Community-Forum""" + if not current_user.is_authenticated: + # Wenn Benutzer nicht angemeldet ist, zeige eine Vorschauversion + forum_categories = ForumCategory.query.filter_by(is_active=True).limit(5).all() + categories_data = [] + for category in forum_categories: + total_posts = ForumPost.query.filter_by(category_id=category.id, parent_id=None).count() + total_replies = ForumPost.query.filter( + ForumPost.category_id == category.id, + ForumPost.parent_id != None + ).count() + + categories_data.append({ + 'category': category, + 'total_posts': total_posts, + 'total_replies': total_replies, + 'latest_post': None + }) + + return render_template('community/preview.html', categories_data=categories_data) - # Statistiken für jede Kategorie berechnen + # Angemeldete Benutzer bekommen die vollständige Version + forum_categories = ForumCategory.query.filter_by(is_active=True).all() categories_data = [] for category in forum_categories: total_posts = ForumPost.query.filter_by(category_id=category.id, parent_id=None).count() @@ -1510,7 +1539,7 @@ def community(): return render_template('community/index.html', categories_data=categories_data) -@app.route('/community/category/') +@app.route('/forum/category/') @login_required def forum_category(category_id): """Zeigt alle Themen in einer bestimmten Kategorie an""" @@ -1540,7 +1569,7 @@ def forum_category(category_id): threads_data=threads_data, node=category.node) -@app.route('/community/post/') +@app.route('/forum/post/') @login_required def forum_post(post_id): """Zeigt einen Beitrag und alle seine Antworten an""" @@ -1563,7 +1592,7 @@ def forum_post(post_id): replies=replies, category=post.category) -@app.route('/community/new-post/', methods=['GET', 'POST']) +@app.route('/forum/new-post/', methods=['GET', 'POST']) @login_required def new_post(category_id): """Erstellt einen neuen Beitrag in einer Kategorie""" @@ -1592,7 +1621,7 @@ def new_post(category_id): return render_template('community/new_post.html', category=category) -@app.route('/community/reply/', methods=['POST']) +@app.route('/forum/reply/', methods=['POST']) @login_required def reply_to_post(post_id): """Antwortet auf einen bestehenden Beitrag""" @@ -1623,7 +1652,7 @@ def reply_to_post(post_id): flash('Deine Antwort wurde erfolgreich hinzugefügt.', 'success') return redirect(url_for('forum_post', post_id=post_id)) -@app.route('/community/edit-post/', methods=['GET', 'POST']) +@app.route('/forum/edit-post/', methods=['GET', 'POST']) @login_required def edit_post(post_id): """Bearbeitet einen bestehenden Beitrag""" @@ -1653,7 +1682,7 @@ def edit_post(post_id): return render_template('community/edit_post.html', post=post) -@app.route('/community/delete-post/', methods=['POST']) +@app.route('/forum/delete-post/', methods=['POST']) @login_required def delete_post(post_id): """Löscht einen Beitrag""" @@ -1680,7 +1709,7 @@ def delete_post(post_id): flash('Der Beitrag wurde erfolgreich gelöscht.', 'success') return redirect(redirect_url) -@app.route('/community/toggle-pin/', methods=['POST']) +@app.route('/forum/toggle-pin/', methods=['POST']) @login_required def toggle_pin_post(post_id): """Fixiert oder löst einen Beitrag von der Fixierung""" @@ -1704,7 +1733,7 @@ def toggle_pin_post(post_id): flash(f'Der Beitrag ist jetzt {status}.', 'success') return redirect(url_for('forum_post', post_id=post_id)) -@app.route('/community/toggle-lock/', methods=['POST']) +@app.route('/forum/toggle-lock/', methods=['POST']) @login_required def toggle_lock_post(post_id): """Sperrt oder entsperrt einen Beitrag für weitere Antworten""" diff --git a/templates/base.html b/templates/base.html index b68067b..7a55e14 100644 --- a/templates/base.html +++ b/templates/base.html @@ -278,11 +278,11 @@ : '{{ 'nav-link-light-active' if request.endpoint == 'mindmap' else 'nav-link-light' }}'"> Mindmap - + ? '{{ 'nav-link-active' if request.endpoint == 'forum' else '' }}' + : '{{ 'nav-link-light-active' if request.endpoint == 'forum' else 'nav-link-light' }}'"> Community Mindmap - + ? '{{ 'bg-purple-500/20 text-white' if request.endpoint == 'forum' else 'text-white/80 hover:bg-gray-800/80 hover:text-white' }}' + : '{{ 'bg-purple-500/10 text-gray-900' if request.endpoint == 'forum' else 'text-gray-700 hover:bg-gray-100 hover:text-gray-900' }}'"> Community Mindmap - Community diff --git a/templates/community/preview.html b/templates/community/preview.html new file mode 100644 index 0000000..481169f --- /dev/null +++ b/templates/community/preview.html @@ -0,0 +1,137 @@ +{% extends 'base.html' %} + +{% block title %}Community Forum Vorschau{% endblock %} + +{% block extra_css %} + +{% endblock %} + +{% block content %} +
+ +
+

Community Forum

+

Diskutiere mit anderen Nutzern über die Hauptthemenbereiche der Mindmap

+
+ + +
+

+ + Anmeldung erforderlich +

+

Um am Community-Forum teilzunehmen und alle Funktionen nutzen zu können, musst du dich anmelden oder registrieren.

+ +
+ + +
+ {% if categories_data %} + {% for cat_data in categories_data %} +
+
+
+ +
+ +
+ + +
+

{{ cat_data.category.title }}

+

{{ cat_data.category.description }}

+ + +
+
+ + {{ cat_data.total_posts }} Themen +
+
+ + {{ cat_data.total_replies }} Antworten +
+
+
+ + +
+ +
+
+
+
+ {% endfor %} + {% else %} +
+
+

Keine Forum-Kategorien gefunden

+

Es sind derzeit keine Kategorien für Diskussionen verfügbar.

+
+ {% endif %} +
+ + +
+

+ + So funktioniert das Forum +

+

Das Community-Forum ist nach den Hauptknotenpunkten der Systades-Mindmap strukturiert. + In deinen Beiträgen kannst du Knotenpunkte mit @Knotenname verlinken.

+ +
+
+
+

Fachliche Diskussionen

+

Tausche dich mit anderen zu spezifischen Themen aus

+
+
+
+

Wissensvernetzung

+

Verknüpfe Inhalte durch Knotenreferenzen

+
+
+
+

Markdown Support

+

Formatiere deine Beiträge mit Markdown

+
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} \ No newline at end of file