"Refactor user mind map template updates for better user experience" (feat)
This commit is contained in:
Binary file not shown.
19
app.py
19
app.py
@@ -1081,9 +1081,11 @@ def add_node_to_mindmap(mindmap_id):
|
||||
return jsonify({'error': 'Nicht autorisiert'}), 403
|
||||
|
||||
node_id = data.get('node_id')
|
||||
parent_id = data.get('parent_id') # Optional: Elternknoten für die Verknüpfung
|
||||
x_pos = data.get('x', 0)
|
||||
y_pos = data.get('y', 0)
|
||||
|
||||
# Knoten abrufen
|
||||
node = MindMapNode.query.get_or_404(node_id)
|
||||
|
||||
# Prüfen, ob der Knoten bereits in der Mindmap existiert
|
||||
@@ -1105,6 +1107,23 @@ def add_node_to_mindmap(mindmap_id):
|
||||
y_position=y_pos
|
||||
)
|
||||
db.session.add(user_node)
|
||||
|
||||
# Wenn ein Elternknoten angegeben wurde, Verbindung erstellen
|
||||
if parent_id:
|
||||
# Existenz des Elternknotens in der Mindmap prüfen
|
||||
parent_node = MindMapNode.query.get(parent_id)
|
||||
parent_user_node = UserMindmapNode.query.filter_by(
|
||||
user_mindmap_id=mindmap_id,
|
||||
node_id=parent_id
|
||||
).first()
|
||||
|
||||
if parent_node and parent_user_node:
|
||||
# Beziehung zwischen den Knoten erstellen
|
||||
try:
|
||||
parent_node.children.append(node)
|
||||
db.session.flush()
|
||||
except Exception as e:
|
||||
print(f"Warnung: Fehler beim Erstellen der Beziehung: {e}")
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@@ -326,6 +326,12 @@
|
||||
x-bind:class="darkMode ? 'border-gray-700/50' : 'border-gray-300/50'">
|
||||
<div id="cy" data-mindmap-id="{{ mindmap.id }}"></div>
|
||||
|
||||
<!-- Container für öffentliche Mindmap (zur Knotenübernahme) -->
|
||||
<div id="public-mindmap-container" class="hidden mt-4 border-t border-gray-300 dark:border-gray-700 pt-4" style="height: 300px;">
|
||||
<h3 class="text-lg font-semibold mb-2 text-center">Öffentliche Mindmap</h3>
|
||||
<div id="public-cy" style="width: 100%; height: 250px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- Informationsanzeige für ausgewählten Knoten -->
|
||||
<div id="node-info-panel" class="node-info-panel p-4">
|
||||
<h3 class="text-xl font-bold gradient-text mb-2">Knotendetails</h3>
|
||||
|
||||
Reference in New Issue
Block a user