Skip to content

Commit

Permalink
fix tooltip for changes in story
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi20750 committed Sep 22, 2024
1 parent 1e59afe commit 5975202
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 7 additions & 6 deletions app/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ def edit_story(story_id):
flash('Story wurde gelöscht.', 'success')
return redirect(url_for('admin.admin'))

# Update story fields based on the form input
story.name = request.form.get('story_name')
story.description = request.form.get('story_description')
db.session.commit()
flash('Änderungen wurden gespeichert.', 'success')
return redirect(url_for('admin.admin'))
if 'save_changes' in request.form: # Check if save changes request is made
# Update story fields based on the form input
story.name = request.form.get('story_name')
story.description = request.form.get('story_description')
db.session.commit()
flash('Änderungen wurden gespeichert.', 'success')
return redirect(url_for('admin.admin'))

return render_template('admin/edit_story.html', story=story, tasks=tasks)

Expand Down
8 changes: 5 additions & 3 deletions app/templates/admin/edit_story.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block content %}
<div class="container mt-4">
<h1>Story bearbeiten: {{ story.name }}</h1>
<form method="POST" onsubmit="return confirm('Sind Sie sicher, dass Sie diese Story löschen möchten?');">
<form method="POST">
<div class="mb-3">
<label for="story_name" class="form-label">Name</label>
<input type="text" class="form-control" id="story_name" name="story_name" value="{{ story.name }}" required>
Expand All @@ -11,6 +11,7 @@ <h1>Story bearbeiten: {{ story.name }}</h1>
<label for="story_description" class="form-label">Beschreibung</label>
<textarea class="form-control" id="story_description" name="story_description" rows="3" required>{{ story.description }}</textarea>
</div>

<h2>Tasks</h2>
{% for task in tasks %}
<div class="card mb-3">
Expand Down Expand Up @@ -38,8 +39,9 @@ <h5 class="card-title">Task: {{ task.name }}</h5>
</div>
</div>
{% endfor %}
<button type="submit" class="btn btn-primary">Änderungen speichern</button>
<button type="submit" name="delete_story" class="btn btn-danger">Story löschen</button>

<button type="submit" name="save_changes" class="btn btn-primary">Änderungen speichern</button>
<button type="submit" name="delete_story" class="btn btn-danger" onclick="return confirm('Sind Sie sicher, dass Sie diese Story löschen möchten?');">Story löschen</button>
</form>
</div>
{% endblock %}

0 comments on commit 5975202

Please sign in to comment.