🎨 style: update profile template and improve app.py functionality

This commit is contained in:
2025-05-02 18:38:59 +02:00
parent c9bbc6ff25
commit 084059449f
3 changed files with 29 additions and 7 deletions

Binary file not shown.

3
app.py
View File

@@ -278,7 +278,8 @@ def admin_required(f):
@login_manager.user_loader
def load_user(id):
return User.query.get(int(id))
# Verwende session.get() anstelle von query.get() für SQLAlchemy 2.0 Kompatibilität
return db.session.get(User, int(id))
# Routes for authentication
@app.route('/login', methods=['GET', 'POST'])

View File

@@ -613,16 +613,37 @@
<div class="tab-content hidden" id="thoughts-tab">
<div id="thoughts-container">
{% if thoughts %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for thought in thoughts %}
<div class="thought-item">
<h3>{{ thought.title }}</h3>
<p>{{ thought.content }}</p>
<div class="thought-meta">
<span>{{ thought.date }}</span>
<span>{{ thought.category }}</span>
<div class="thought-item bg-opacity-70 rounded-xl overflow-hidden border transition-all duration-300 hover:transform hover:scale-105 hover:shadow-lg"
x-bind:class="darkMode ? 'bg-gray-800/80 border-gray-700/60' : 'bg-white/90 border-gray-200/60'">
<div class="p-5" style="border-left: 4px solid {{ thought.color_code|default('#B39DDB') }}">
<h3 class="text-xl font-bold mb-2"
x-bind:class="darkMode ? 'text-purple-300' : 'text-purple-700'">{{ thought.title }}</h3>
<p class="mb-4 text-sm"
x-bind:class="darkMode ? 'text-gray-300' : 'text-gray-600'">
{{ thought.abstract or thought.content[:150] ~ '...' }}
</p>
<div class="flex justify-between items-center text-xs"
x-bind:class="darkMode ? 'text-gray-400' : 'text-gray-500'">
<span>{{ thought.created_at.strftime('%d.%m.%Y') }}</span>
<span>{{ thought.branch }}</span>
</div>
</div>
<div class="p-3 border-t flex justify-between items-center"
x-bind:class="darkMode ? 'bg-gray-900/80 border-gray-700/60' : 'bg-gray-50/80 border-gray-200/60'">
<a href="{{ url_for('get_thought', thought_id=thought.id) }}" class="transition-colors"
x-bind:class="darkMode ? 'text-purple-400 hover:text-purple-300' : 'text-purple-600 hover:text-purple-500'">
<i class="fas fa-eye mr-1"></i> Ansehen
</a>
<a href="{{ url_for('update_thought', thought_id=thought.id) }}" class="transition-colors"
x-bind:class="darkMode ? 'text-blue-400 hover:text-blue-300' : 'text-blue-600 hover:text-blue-500'">
<i class="fas fa-edit mr-1"></i> Bearbeiten
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-12">
<i class="fas fa-lightbulb text-5xl text-gray-400 mb-4"></i>