Compare commits

...

2 Commits

4 changed files with 7 additions and 31 deletions

Binary file not shown.

Binary file not shown.

34
app.py
View File

@@ -25,7 +25,7 @@ import sqlalchemy
from models import (
db, User, Thought, Comment, MindMapNode, ThoughtRelation, ThoughtRating,
RelationType, Category, UserMindmap, UserMindmapNode, MindmapNote,
node_thought_association, user_thought_bookmark, node_relationship, ForumCategory, ForumPost
node_thought_association, user_thought_bookmark, node_relationship
)
# Lade .env-Datei
@@ -191,31 +191,6 @@ def create_default_categories():
db.session.commit()
print("Standard-Kategorien wurden erstellt!")
def create_forum_categories():
"""Erstellt Forum-Kategorien basierend auf Hauptknotenpunkten der Mindmap"""
# Hauptknotenpunkte abrufen (nur die, die keine Elternknoten haben)
main_nodes = MindMapNode.query.filter(~MindMapNode.id.in_(
db.session.query(node_relationship.c.child_id)
)).all()
for node in main_nodes:
# Prüfen, ob eine Forum-Kategorie für diesen Knoten bereits existiert
existing_category = ForumCategory.query.filter_by(node_id=node.id).first()
if existing_category:
continue
# Neue Kategorie erstellen
forum_category = ForumCategory(
node_id=node.id,
title=node.name,
description=node.description,
is_active=True
)
db.session.add(forum_category)
db.session.commit()
print("Forum-Kategorien wurden für alle Hauptknotenpunkte erstellt!")
def initialize_database():
"""Initialisiert die Datenbank mit Grunddaten, falls diese leer ist"""
try:
@@ -245,9 +220,6 @@ def initialize_database():
db.session.commit()
print("Admin-Benutzer wurde erstellt!")
# Forum-Kategorien erstellen
create_forum_categories()
return True
except Exception as e:
print(f"Fehler bei Datenbank-Initialisierung: {e}")
@@ -1838,13 +1810,13 @@ def refresh_mindmap():
def mindmap_page():
return render_template('mindmap.html')
# Einfache Umleitungen für Community/Forum-Routen
# Weiterleitung für Community/Forum-Routen
@app.route('/community')
@app.route('/Community')
@app.route('/forum')
@app.route('/Forum')
@app.route('/community_forum')
def redirect_to_index():
def redirect_community():
"""Leitet alle Community/Forum-URLs zur Startseite um"""
return redirect(url_for('index'))

View File

@@ -657,6 +657,10 @@
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Mindmap
</a>
<a href="{{ url_for('search_thoughts_page') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">
Suche
</a>
{% if current_user.is_authenticated %}
<a href="{{ url_for('profile') }}" class="text-sm transition-all duration-200"
:class="darkMode ? 'text-gray-300 hover:text-white' : 'text-gray-600 hover:text-gray-900'">