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 b59b001..6fbf834 100644 Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ 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